Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: chrome/browser/push_messaging/push_messaging_notification_manager_unittest.cc

Issue 1467573003: PushMessagingNotificationManager: extract IsTabVisible and test it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address peter's comments. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « chrome/browser/push_messaging/push_messaging_notification_manager.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698