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

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: 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"
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698