OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <deque> | 5 #include <deque> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 | 849 |
850 // Test that user can close tab when infobar present. | 850 // Test that user can close tab when infobar present. |
851 ui_test_utils::NavigateToURLWithDisposition( | 851 ui_test_utils::NavigateToURLWithDisposition( |
852 browser(), | 852 browser(), |
853 GURL("about:blank"), | 853 GURL("about:blank"), |
854 NEW_BACKGROUND_TAB, | 854 NEW_BACKGROUND_TAB, |
855 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); | 855 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); |
856 browser()->tab_strip_model()->ActivateTabAt(0, true); | 856 browser()->tab_strip_model()->ActivateTabAt(0, true); |
857 ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); | 857 ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); |
858 ASSERT_TRUE(RequestPermissionAndWait(browser())); | 858 ASSERT_TRUE(RequestPermissionAndWait(browser())); |
859 content::WindowedNotificationObserver observer( | 859 content::WebContentsDestroyedWatcher destroyed_watcher( |
860 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 860 browser()->tab_strip_model()->GetWebContentsAt(0)); |
861 content::NotificationService::AllSources()); | |
862 browser()->tab_strip_model()->CloseWebContentsAt(0, | 861 browser()->tab_strip_model()->CloseWebContentsAt(0, |
863 TabStripModel::CLOSE_NONE); | 862 TabStripModel::CLOSE_NONE); |
864 observer.Wait(); | 863 destroyed_watcher.Wait(); |
865 } | 864 } |
866 | 865 |
867 IN_PROC_BROWSER_TEST_F( | 866 IN_PROC_BROWSER_TEST_F( |
868 NotificationsTest, | 867 NotificationsTest, |
869 TestNavigateAwayWithPermissionInfobar) { | 868 TestNavigateAwayWithPermissionInfobar) { |
870 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 869 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
871 | 870 |
872 // Test navigating away when an infobar is present, | 871 // Test navigating away when an infobar is present, |
873 // then trying to create a notification from the same page. | 872 // then trying to create a notification from the same page. |
874 ui_test_utils::NavigateToURLWithDisposition( | 873 ui_test_utils::NavigateToURLWithDisposition( |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 const std::deque<Balloon*>& balloons = GetActiveBalloons(); | 941 const std::deque<Balloon*>& balloons = GetActiveBalloons(); |
943 ASSERT_EQ(1U, balloons.size()); | 942 ASSERT_EQ(1U, balloons.size()); |
944 Balloon* balloon = balloons[0]; | 943 Balloon* balloon = balloons[0]; |
945 const Notification& notification = balloon->notification(); | 944 const Notification& notification = balloon->notification(); |
946 GURL EXPECTED_ICON_URL = embedded_test_server()->GetURL(kExpectedIconUrl); | 945 GURL EXPECTED_ICON_URL = embedded_test_server()->GetURL(kExpectedIconUrl); |
947 EXPECT_EQ(EXPECTED_ICON_URL, notification.icon_url()); | 946 EXPECT_EQ(EXPECTED_ICON_URL, notification.icon_url()); |
948 EXPECT_EQ(ASCIIToUTF16("Title2"), notification.title()); | 947 EXPECT_EQ(ASCIIToUTF16("Title2"), notification.title()); |
949 EXPECT_EQ(ASCIIToUTF16("Body2"), notification.message()); | 948 EXPECT_EQ(ASCIIToUTF16("Body2"), notification.message()); |
950 } | 949 } |
951 } | 950 } |
OLD | NEW |