OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/push_messaging/push_messaging_notification_manager.h" |
| 6 |
| 7 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 8 #include "chrome/test/base/testing_profile.h" |
| 9 #include "content/public/test/test_renderer_host.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "url/gurl.h" |
| 12 |
| 13 class PushMessagingNotificationManagerTest |
| 14 : public ChromeRenderViewHostTestHarness {}; |
| 15 |
| 16 TEST_F(PushMessagingNotificationManagerTest, IsTabVisible) { |
| 17 PushMessagingNotificationManager manager(profile()); |
| 18 GURL origin("https://google.com/"); |
| 19 NavigateAndCommit(origin); |
| 20 |
| 21 EXPECT_FALSE(manager.IsTabVisible(profile(), nullptr, origin)); |
| 22 EXPECT_FALSE(manager.IsTabVisible(profile(), web_contents(), |
| 23 GURL("https://chrome.com/"))); |
| 24 EXPECT_TRUE(manager.IsTabVisible(profile(), web_contents(), origin)); |
| 25 |
| 26 content::RenderViewHostTester::For(rvh())->SimulateWasHidden(); |
| 27 EXPECT_FALSE(manager.IsTabVisible(profile(), web_contents(), origin)); |
| 28 |
| 29 content::RenderViewHostTester::For(rvh())->SimulateWasShown(); |
| 30 EXPECT_TRUE(manager.IsTabVisible(profile(), web_contents(), origin)); |
| 31 } |
OLD | NEW |