Chromium Code Reviews| 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" | |
|
Peter Beverloo
2015/11/23 13:14:25
+url/gurl.h
Michael van Ouwerkerk
2015/11/23 13:25:09
Done.
| |
| 11 | |
| 12 class PushMessagingNotificationManagerTest | |
| 13 : public ChromeRenderViewHostTestHarness {}; | |
| 14 | |
| 15 TEST_F(PushMessagingNotificationManagerTest, IsTabVisible) { | |
| 16 PushMessagingNotificationManager manager(profile()); | |
| 17 GURL origin("https://google.com/"); | |
| 18 NavigateAndCommit(origin); | |
| 19 | |
| 20 EXPECT_FALSE(manager.IsTabVisible(profile(), nullptr, origin)); | |
| 21 EXPECT_FALSE(manager.IsTabVisible(profile(), web_contents(), | |
| 22 GURL("https://chrome.com/"))); | |
| 23 EXPECT_TRUE(manager.IsTabVisible(profile(), web_contents(), origin)); | |
| 24 | |
| 25 content::RenderViewHostTester::For(rvh())->SimulateWasHidden(); | |
| 26 EXPECT_FALSE(manager.IsTabVisible(profile(), web_contents(), origin)); | |
| 27 | |
| 28 content::RenderViewHostTester::For(rvh())->SimulateWasShown(); | |
| 29 EXPECT_TRUE(manager.IsTabVisible(profile(), web_contents(), origin)); | |
| 30 } | |
| OLD | NEW |