diff options
100 files changed, 632 insertions, 580 deletions
diff --git a/chrome/browser/accessibility/accessibility_win_browsertest.cc b/chrome/browser/accessibility/accessibility_win_browsertest.cc index ab4bbe8..29bae65 100644 --- a/chrome/browser/accessibility/accessibility_win_browsertest.cc +++ b/chrome/browser/accessibility/accessibility_win_browsertest.cc @@ -398,7 +398,7 @@ string16 AccessibleChecker::RoleVariantToString(VARIANT* role_variant) { IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, TestRendererAccessibilityTree) { - ui_test_utils::WindowedNotificationObserver tree_updated_observer1( + content::WindowedNotificationObserver tree_updated_observer1( content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); @@ -416,7 +416,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, STATE_SYSTEM_READONLY | STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_FOCUSED); document1_checker.CheckAccessible(GetRendererAccessible()); - ui_test_utils::WindowedNotificationObserver tree_updated_observer2( + content::WindowedNotificationObserver tree_updated_observer2( content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); GURL tree_url( @@ -460,7 +460,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, TestNotificationActiveDescendantChanged) { - ui_test_utils::WindowedNotificationObserver tree_updated_observer1( + content::WindowedNotificationObserver tree_updated_observer1( content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); GURL tree_url("data:text/html,<ul tabindex='-1' role='radiogroup'><li id='li'" @@ -488,7 +488,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, document_checker.CheckAccessible(GetRendererAccessible()); // Set focus to the radio group. - ui_test_utils::WindowedNotificationObserver tree_updated_observer2( + content::WindowedNotificationObserver tree_updated_observer2( content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); ExecuteScript(L"document.body.children[0].focus()"); @@ -500,7 +500,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, document_checker.CheckAccessible(GetRendererAccessible()); // Set the active descendant of the radio group - ui_test_utils::WindowedNotificationObserver tree_updated_observer3( + content::WindowedNotificationObserver tree_updated_observer3( content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); ExecuteScript( @@ -516,7 +516,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, TestNotificationCheckedStateChanged) { - ui_test_utils::WindowedNotificationObserver tree_updated_observer1( + content::WindowedNotificationObserver tree_updated_observer1( content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); GURL tree_url("data:text/html,<body><input type='checkbox' /></body>"); @@ -536,7 +536,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, document_checker.CheckAccessible(GetRendererAccessible()); // Check the checkbox. - ui_test_utils::WindowedNotificationObserver tree_updated_observer2( + content::WindowedNotificationObserver tree_updated_observer2( content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); ExecuteScript(L"document.body.children[0].checked=true"); @@ -550,7 +550,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, TestNotificationChildrenChanged) { - ui_test_utils::WindowedNotificationObserver tree_updated_observer1( + content::WindowedNotificationObserver tree_updated_observer1( content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); // The role attribute causes the node to be in the accessibility tree. @@ -569,7 +569,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, document_checker.CheckAccessible(GetRendererAccessible()); // Change the children of the document body. - ui_test_utils::WindowedNotificationObserver tree_updated_observer2( + content::WindowedNotificationObserver tree_updated_observer2( content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); ExecuteScript(L"document.body.innerHTML='<b>new text</b>'"); @@ -583,7 +583,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, TestNotificationChildrenChanged2) { - ui_test_utils::WindowedNotificationObserver tree_updated_observer1( + content::WindowedNotificationObserver tree_updated_observer1( content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); // The role attribute causes the node to be in the accessibility tree. @@ -601,7 +601,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, document_checker.CheckAccessible(GetRendererAccessible()); // Change the children of the document body. - ui_test_utils::WindowedNotificationObserver tree_updated_observer2( + content::WindowedNotificationObserver tree_updated_observer2( content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); ExecuteScript(L"document.body.children[0].style.visibility='visible'"); @@ -617,7 +617,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, TestNotificationFocusChanged) { - ui_test_utils::WindowedNotificationObserver tree_updated_observer1( + content::WindowedNotificationObserver tree_updated_observer1( content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); // The role attribute causes the node to be in the accessibility tree. @@ -639,7 +639,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, document_checker.CheckAccessible(GetRendererAccessible()); // Focus the div in the document - ui_test_utils::WindowedNotificationObserver tree_updated_observer2( + content::WindowedNotificationObserver tree_updated_observer2( content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); ExecuteScript(L"document.body.children[0].focus()"); @@ -652,7 +652,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, document_checker.CheckAccessible(GetRendererAccessible()); // Focus the document accessible. This will un-focus the current node. - ui_test_utils::WindowedNotificationObserver tree_updated_observer3( + content::WindowedNotificationObserver tree_updated_observer3( content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); base::win::ScopedComPtr<IAccessible> document_accessible( @@ -671,7 +671,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, TestNotificationValueChanged) { - ui_test_utils::WindowedNotificationObserver tree_updated_observer1( + content::WindowedNotificationObserver tree_updated_observer1( content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); GURL tree_url("data:text/html,<body><input type='text' value='old value'/>" @@ -693,7 +693,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, document_checker.CheckAccessible(GetRendererAccessible()); // Set the value of the text control - ui_test_utils::WindowedNotificationObserver tree_updated_observer2( + content::WindowedNotificationObserver tree_updated_observer2( content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); ExecuteScript(L"document.body.children[0].value='new value'"); @@ -714,7 +714,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, // provided by RenderWidgetHostViewWin in GetNativeViewAccessible(). IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, ContainsRendererAccessibilityTree) { - ui_test_utils::WindowedNotificationObserver tree_updated_observer1( + content::WindowedNotificationObserver tree_updated_observer1( content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); GURL tree_url("data:text/html,<html><head><title>MyDocument</title></head>" @@ -743,7 +743,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, TestToggleButtonRoleAndStates) { - ui_test_utils::WindowedNotificationObserver tree_updated_observer1( + content::WindowedNotificationObserver tree_updated_observer1( content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); AccessibleChecker* button_checker; @@ -823,7 +823,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, SupportsISimpleDOM) { - ui_test_utils::WindowedNotificationObserver tree_updated_observer1( + content::WindowedNotificationObserver tree_updated_observer1( content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); GURL tree_url("data:text/html,<body><input type='checkbox' /></body>"); @@ -890,7 +890,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, } IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, TestRoleGroup) { - ui_test_utils::WindowedNotificationObserver tree_updated_observer1( + content::WindowedNotificationObserver tree_updated_observer1( content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); GURL tree_url("data:text/html,<fieldset></fieldset><div role=group></div>"); diff --git a/chrome/browser/autocomplete/autocomplete_browsertest.cc b/chrome/browser/autocomplete/autocomplete_browsertest.cc index e83da16..8a41505 100644 --- a/chrome/browser/autocomplete/autocomplete_browsertest.cc +++ b/chrome/browser/autocomplete/autocomplete_browsertest.cc @@ -153,7 +153,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, TabAwayRevertSelect) { OmniboxView* location_entry = location_bar->GetLocationEntry(); EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), location_entry->GetText()); location_entry->SetUserText(string16()); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::AddSelectedTabWithURL(browser(), GURL(chrome::kAboutBlankURL), diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc index 77a8276..985f371 100644 --- a/chrome/browser/autofill/autofill_browsertest.cc +++ b/chrome/browser/autofill/autofill_browsertest.cc @@ -210,7 +210,7 @@ class AutofillTest : public InProcessBrowserTest { } void SendKeyAndWait(ui::KeyboardCode key, int notification_type) { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( notification_type, content::Source<RenderViewHost>(render_view_host())); ui_test_utils::SimulateKeyPress(chrome::GetActiveWebContents( browser()), key, false, false, false, false); @@ -691,7 +691,7 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, AutofillAfterTranslate) { // Pass fake google.translate lib as the translate script. SimulateURLFetch(true); - ui_test_utils::WindowedNotificationObserver translation_observer( + content::WindowedNotificationObserver translation_observer( chrome::NOTIFICATION_PAGE_TRANSLATED, content::NotificationService::AllSources()); diff --git a/chrome/browser/autofill/autofill_popup_view_browsertest.cc b/chrome/browser/autofill/autofill_popup_view_browsertest.cc index 8d55152..7fd9ced 100644 --- a/chrome/browser/autofill/autofill_popup_view_browsertest.cc +++ b/chrome/browser/autofill/autofill_popup_view_browsertest.cc @@ -10,13 +10,13 @@ #include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/in_process_browser_test.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" #include "content/public/browser/page_navigator.h" #include "content/public/browser/web_contents.h" #include "content/public/common/url_constants.h" +#include "content/public/test/test_utils.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -80,7 +80,7 @@ IN_PROC_BROWSER_TEST_F(AutofillPopupViewBrowserTest, SwitchTabAndHideAutofillPopup) { EXPECT_CALL(*autofill_popup_view_, Hide()).Times(AtLeast(1)); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, content::Source<content::WebContents>(web_contents_)); chrome::AddSelectedTabWithURL(browser(), GURL(chrome::kAboutBlankURL), @@ -94,7 +94,7 @@ IN_PROC_BROWSER_TEST_F(AutofillPopupViewBrowserTest, TestPageNavigationHidingAutofillPopup) { EXPECT_CALL(*autofill_popup_view_, Hide()).Times(AtLeast(1)); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<content::NavigationController>( &(web_contents_->GetController()))); diff --git a/chrome/browser/browser_encoding_browsertest.cc b/chrome/browser/browser_encoding_browsertest.cc index 00bcd16..52ddfe3 100644 --- a/chrome/browser/browser_encoding_browsertest.cc +++ b/chrome/browser/browser_encoding_browsertest.cc @@ -41,7 +41,7 @@ class BrowserEncodingTest : public InProcessBrowserTest { // We save the page as way of complete HTML file, which requires a directory // name to save sub resources in it. Although this test file does not have // sub resources, but the directory name is still required. - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED, content::NotificationService::AllSources()); chrome::GetActiveWebContents(browser())->SavePage( diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc index 946381f..a3ca0ca 100644 --- a/chrome/browser/browser_focus_uitest.cc +++ b/chrome/browser/browser_focus_uitest.cc @@ -871,7 +871,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) { // Open the new tab, reload. { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::NewTab(browser()); @@ -880,7 +880,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) { ui_test_utils::RunAllPendingInMessageLoop(); { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); @@ -895,7 +895,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) { chrome::FocusLocationBar(browser()); ASSERT_TRUE(IsViewFocused(location_bar_focus_view_id_)); { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); @@ -917,7 +917,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_FocusOnReloadCrashedTab) { ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(kSimplePage)); ui_test_utils::CrashTab(chrome::GetActiveWebContents(browser())); { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); diff --git a/chrome/browser/browser_keyevents_browsertest.cc b/chrome/browser/browser_keyevents_browsertest.cc index 5eb0f47..6bde704 100644 --- a/chrome/browser/browser_keyevents_browsertest.cc +++ b/chrome/browser/browser_keyevents_browsertest.cc @@ -707,7 +707,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_ReservedAccelerators) { #endif }; - ui_test_utils::WindowedNotificationObserver wait_for_new_tab( + content::WindowedNotificationObserver wait_for_new_tab( chrome::NOTIFICATION_TAB_PARENTED, content::NotificationService::AllSources()); @@ -734,7 +734,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_ReservedAccelerators) { // Reserved accelerators can't be suppressed. ASSERT_NO_FATAL_FAILURE(SuppressAllEvents(1, true)); - ui_test_utils::WindowedNotificationObserver wait_for_tab_closed( + content::WindowedNotificationObserver wait_for_tab_closed( content::NOTIFICATION_WEB_CONTENTS_DESTROYED, content::Source<content::WebContents>(chrome::GetWebContentsAt(browser(), 1))); diff --git a/chrome/browser/chrome_main_browsertest.cc b/chrome/browser/chrome_main_browsertest.cc index 3ee6f63..50e45a6 100644 --- a/chrome/browser/chrome_main_browsertest.cc +++ b/chrome/browser/chrome_main_browsertest.cc @@ -50,7 +50,7 @@ IN_PROC_BROWSER_TEST_F(ChromeMainTest, ReuseBrowserInstanceWhenOpeningFile) { FilePath(), FilePath().AppendASCII("empty.html")); CommandLine new_command_line(GetCommandLineForRelaunch()); new_command_line.AppendArgPath(test_file_path); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_TAB_ADDED, content::NotificationService::AllSources()); Relaunch(new_command_line); @@ -103,7 +103,7 @@ IN_PROC_BROWSER_TEST_F(ChromeMainTest, SecondLaunchFromIncognitoWithNormalUrl) { // Close the first window. Profile* profile = browser()->profile(); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_BROWSER_CLOSED, content::NotificationService::AllSources()); chrome::CloseWindow(browser()); @@ -118,7 +118,7 @@ IN_PROC_BROWSER_TEST_F(ChromeMainTest, SecondLaunchFromIncognitoWithNormalUrl) { FilePath(), FilePath().AppendASCII("empty.html")); CommandLine new_command_line(GetCommandLineForRelaunch()); new_command_line.AppendArgPath(test_file_path); - ui_test_utils::WindowedNotificationObserver tab_observer( + content::WindowedNotificationObserver tab_observer( chrome::NOTIFICATION_TAB_ADDED, content::NotificationService::AllSources()); Relaunch(new_command_line); diff --git a/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc b/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc index 45d2609..0935241 100644 --- a/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc +++ b/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc @@ -26,9 +26,9 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" +#include "content/public/test/test_utils.h" #include "testing/gmock/include/gmock/gmock.h" #include "webkit/fileapi/file_system_context.h" #include "webkit/fileapi/file_system_mount_point_provider.h" @@ -84,8 +84,8 @@ class BackgroundObserver { } private: - ui_test_utils::WindowedNotificationObserver page_created_; - ui_test_utils::WindowedNotificationObserver page_closed_; + content::WindowedNotificationObserver page_created_; + content::WindowedNotificationObserver page_closed_; }; // TODO(tbarzic): We should probably share GetTestFilePath and LoadJSONFile diff --git a/chrome/browser/chromeos/login/screen_locker_browsertest.cc b/chrome/browser/chromeos/login/screen_locker_browsertest.cc index b10bc4f..d9d22c1 100644 --- a/chrome/browser/chromeos/login/screen_locker_browsertest.cc +++ b/chrome/browser/chromeos/login/screen_locker_browsertest.cc @@ -93,7 +93,7 @@ class ScreenLockerTest : public CrosInProcessBrowserTest { void LockScreen(test::ScreenLockerTester* tester) { ScreenLocker::Show(); tester->EmulateWindowManagerReady(); - ui_test_utils::WindowedNotificationObserver lock_state_observer( + content::WindowedNotificationObserver lock_state_observer( chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, content::NotificationService::AllSources()); if (!tester->IsLocked()) @@ -139,7 +139,7 @@ IN_PROC_BROWSER_TEST_F(ScreenLockerTest, TestBasic) { ScreenLocker::Show(); scoped_ptr<test::ScreenLockerTester> tester(ScreenLocker::GetTester()); tester->EmulateWindowManagerReady(); - ui_test_utils::WindowedNotificationObserver lock_state_observer( + content::WindowedNotificationObserver lock_state_observer( chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, content::NotificationService::AllSources()); if (!chromeos::ScreenLocker::GetTester()->IsLocked()) diff --git a/chrome/browser/chromeos/oom_priority_manager_browsertest.cc b/chrome/browser/chromeos/oom_priority_manager_browsertest.cc index 4d85eec..93a776f 100644 --- a/chrome/browser/chromeos/oom_priority_manager_browsertest.cc +++ b/chrome/browser/chromeos/oom_priority_manager_browsertest.cc @@ -11,9 +11,9 @@ #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/in_process_browser_test.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/test/test_utils.h" #include "googleurl/src/gurl.h" using content::OpenURLParams; @@ -23,7 +23,7 @@ namespace { typedef InProcessBrowserTest OomPriorityManagerTest; IN_PROC_BROWSER_TEST_F(OomPriorityManagerTest, OomPriorityManagerBasics) { - using ui_test_utils::WindowedNotificationObserver; + using content::WindowedNotificationObserver; // Get three tabs open. WindowedNotificationObserver load1( diff --git a/chrome/browser/crash_recovery_browsertest.cc b/chrome/browser/crash_recovery_browsertest.cc index 439c3ce..b25cc1f 100644 --- a/chrome/browser/crash_recovery_browsertest.cc +++ b/chrome/browser/crash_recovery_browsertest.cc @@ -23,7 +23,7 @@ using content::Referrer; namespace { void SimulateRendererCrash(Browser* browser) { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, content::NotificationService::AllSources()); browser->OpenURL(OpenURLParams( @@ -51,7 +51,7 @@ IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, Reload) { ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &title_before_crash)); SimulateRendererCrash(browser()); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); @@ -80,7 +80,7 @@ IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, LoadInNewTab) { ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &title_before_crash)); SimulateRendererCrash(browser()); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); diff --git a/chrome/browser/debugger/devtools_sanity_browsertest.cc b/chrome/browser/debugger/devtools_sanity_browsertest.cc index 7cb6d2f..e552a9f 100644 --- a/chrome/browser/debugger/devtools_sanity_browsertest.cc +++ b/chrome/browser/debugger/devtools_sanity_browsertest.cc @@ -136,7 +136,7 @@ class DevToolsSanityTest : public InProcessBrowserTest { GURL url = test_server()->GetURL(test_page); ui_test_utils::NavigateToURL(browser(), url); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); inspected_rvh_ = GetInspectedTab()->GetRenderViewHost(); @@ -393,7 +393,7 @@ class WorkerDevToolsSanityTest : public InProcessBrowserTest { RenderViewHost* client_rvh = window_->GetRenderViewHost(); WebContents* client_contents = WebContents::FromRenderViewHost(client_rvh); if (client_contents->IsLoading()) { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &client_contents->GetController())); @@ -528,7 +528,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestReattachAfterCrash) { OpenDevToolsWindow(kDebuggerTestPage); ui_test_utils::CrashTab(GetInspectedTab()); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index 4b21c37..9e0a0f0 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc @@ -1172,7 +1172,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, IncognitoDownload) { // On Mac OS X, the UI window close is delayed until the outermost // message loop runs. So it isn't possible to get a BROWSER_CLOSED // notification inside of a test. - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_BROWSER_CLOSED, content::Source<Browser>(incognito)); #endif @@ -1415,7 +1415,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, NewWindow) { // On Mac OS X, the UI window close is delayed until the outermost // message loop runs. So it isn't possible to get a BROWSER_CLOSED // notification inside of a test. - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_BROWSER_CLOSED, content::Source<Browser>(download_browser)); #endif @@ -1637,7 +1637,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, BrowserCloseAfterDownload) { DownloadAndWait(browser(), download_url, EXPECT_NO_SELECT_DIALOG); - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_BROWSER_CLOSED, content::Source<Browser>(browser())); chrome::CloseWindow(browser()); @@ -2118,7 +2118,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, SavePageNonHTMLViaPost) { ASSERT_TRUE(jpeg_url.is_valid()); WebContents* web_contents = chrome::GetActiveWebContents(browser()); ASSERT_TRUE(web_contents != NULL); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<content::NavigationController>( &web_contents->GetController())); diff --git a/chrome/browser/download/save_page_browsertest.cc b/chrome/browser/download/save_page_browsertest.cc index 0d4a106..85d69f8 100644 --- a/chrome/browser/download/save_page_browsertest.cc +++ b/chrome/browser/download/save_page_browsertest.cc @@ -108,7 +108,7 @@ class SavePageBrowserTest : public InProcessBrowserTest { GURL WaitForSavePackageToFinish() const { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED, content::NotificationService::AllSources()); observer.Wait(); @@ -363,7 +363,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, CleanFilenameFromPageTitle) { ui_test_utils::NavigateToURL(browser(), url); SavePackageFilePicker::SetShouldPromptUser(false); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED, content::NotificationService::AllSources()); chrome::SavePage(browser()); @@ -403,7 +403,7 @@ IN_PROC_BROWSER_TEST_F(SavePageAsMHTMLBrowserTest, SavePageAsMHTML) { #else SavePackageFilePicker::SetShouldPromptUser(false); #endif - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED, content::NotificationService::AllSources()); chrome::SavePage(browser()); diff --git a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc index c0902ee..9aafa07 100644 --- a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc +++ b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc @@ -42,7 +42,7 @@ class BrowserActionApiTest : public ExtensionApiTest { bool OpenPopup(int index) { ResultCatcher catcher; - ui_test_utils::WindowedNotificationObserver popup_observer( + content::WindowedNotificationObserver popup_observer( content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, content::NotificationService::AllSources()); GetBrowserActionsBar().Press(index); @@ -399,7 +399,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, DISABLED_CloseBackgroundPage) { ExtensionAction* action = extension->browser_action(); ASSERT_EQ("", action->GetBadgeText(ExtensionAction::kDefaultTabId)); - ui_test_utils::WindowedNotificationObserver host_destroyed_observer( + content::WindowedNotificationObserver host_destroyed_observer( chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, content::NotificationService::AllSources()); diff --git a/chrome/browser/extensions/api/omnibox/omnibox_apitest.cc b/chrome/browser/extensions/api/omnibox/omnibox_apitest.cc index e967917..4b4e1db 100644 --- a/chrome/browser/extensions/api/omnibox/omnibox_apitest.cc +++ b/chrome/browser/extensions/api/omnibox/omnibox_apitest.cc @@ -59,7 +59,7 @@ class OmniboxApiTest : public ExtensionApiTest { // TODO(phajdan.jr): Get rid of this wait-in-a-loop pattern. void WaitForAutocompleteDone(AutocompleteController* controller) { while (!controller->done()) { - ui_test_utils::WindowedNotificationObserver ready_observer( + content::WindowedNotificationObserver ready_observer( chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, content::Source<AutocompleteController>(controller)); ready_observer.Wait(); diff --git a/chrome/browser/extensions/app_background_page_apitest.cc b/chrome/browser/extensions/app_background_page_apitest.cc index e397b5c..a052e72 100644 --- a/chrome/browser/extensions/app_background_page_apitest.cc +++ b/chrome/browser/extensions/app_background_page_apitest.cc @@ -15,9 +15,9 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/notification_service.h" #include "content/public/test/test_notification_tracker.h" +#include "content/public/test/test_utils.h" #include "net/base/mock_host_resolver.h" using extensions::Extension; @@ -68,7 +68,7 @@ class AppBackgroundPageApiTest : public ExtensionApiTest { // We are not currently in the expected state - wait for the state to // change. - ui_test_utils::WindowedNotificationObserver watcher( + content::WindowedNotificationObserver watcher( chrome::NOTIFICATION_BACKGROUND_MODE_CHANGED, content::NotificationService::AllSources()); watcher.Wait(); diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc index fdc73a7..4fae148 100644 --- a/chrome/browser/extensions/app_process_apitest.cc +++ b/chrome/browser/extensions/app_process_apitest.cc @@ -85,7 +85,7 @@ class AppApiTest : public ExtensionApiTest { chrome::GetWebContentsAt(browser(), 1)->GetRenderProcessHost()->GetID())); EXPECT_FALSE(chrome::GetWebContentsAt(browser(), 1)->GetWebUI()); - ui_test_utils::WindowedNotificationObserver tab_added_observer( + content::WindowedNotificationObserver tab_added_observer( chrome::NOTIFICATION_TAB_ADDED, content::NotificationService::AllSources()); chrome::NewTab(browser()); @@ -154,7 +154,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcess) { EXPECT_FALSE(chrome::GetWebContentsAt(browser(), 2)->GetWebUI()); LOG(INFO) << "Nav 2."; - ui_test_utils::WindowedNotificationObserver tab_added_observer( + content::WindowedNotificationObserver tab_added_observer( chrome::NOTIFICATION_TAB_ADDED, content::NotificationService::AllSources()); chrome::NewTab(browser()); @@ -266,7 +266,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, BookmarkAppGetsNormalProcess) { chrome::GetWebContentsAt(browser(), 1)->GetRenderProcessHost()->GetID())); EXPECT_FALSE(chrome::GetWebContentsAt(browser(), 1)->GetWebUI()); - ui_test_utils::WindowedNotificationObserver tab_added_observer( + content::WindowedNotificationObserver tab_added_observer( chrome::NOTIFICATION_TAB_ADDED, content::NotificationService::AllSources()); chrome::NewTab(browser()); @@ -386,7 +386,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_ReloadIntoAppProcess) { // Enable app and reload the page. EnableExtension(app->id()); - ui_test_utils::WindowedNotificationObserver reload_observer( + content::WindowedNotificationObserver reload_observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); @@ -397,7 +397,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_ReloadIntoAppProcess) { // Disable app and reload the page. DisableExtension(app->id()); - ui_test_utils::WindowedNotificationObserver reload_observer2( + content::WindowedNotificationObserver reload_observer2( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); @@ -408,7 +408,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_ReloadIntoAppProcess) { // Enable app and reload via JavaScript. EnableExtension(app->id()); - ui_test_utils::WindowedNotificationObserver js_reload_observer( + content::WindowedNotificationObserver js_reload_observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); @@ -420,7 +420,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_ReloadIntoAppProcess) { // Disable app and reload via JavaScript. DisableExtension(app->id()); - ui_test_utils::WindowedNotificationObserver js_reload_observer2( + content::WindowedNotificationObserver js_reload_observer2( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); @@ -450,7 +450,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, OpenAppFromIframe) { LoadExtension(test_data_dir_.AppendASCII("app_process")); ASSERT_TRUE(app); - ui_test_utils::WindowedNotificationObserver popup_observer( + content::WindowedNotificationObserver popup_observer( content::NOTIFICATION_RENDER_VIEW_HOST_CREATED, content::NotificationService::AllSources()); ui_test_utils::NavigateToURL(browser(), @@ -528,7 +528,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, OpenWebPopupFromWebIframe) { LoadExtension(test_data_dir_.AppendASCII("app_process")); ASSERT_TRUE(app); - ui_test_utils::WindowedNotificationObserver popup_observer( + content::WindowedNotificationObserver popup_observer( content::NOTIFICATION_RENDER_VIEW_HOST_CREATED, content::NotificationService::AllSources()); ui_test_utils::NavigateToURL(browser(), @@ -577,7 +577,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_ReloadAppAfterCrash) { // Crash the tab and reload it, chrome.app.isInstalled should still be true. ui_test_utils::CrashTab(chrome::GetActiveWebContents(browser())); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); diff --git a/chrome/browser/extensions/content_script_apitest.cc b/chrome/browser/extensions/content_script_apitest.cc index 560e713..4025df4 100644 --- a/chrome/browser/extensions/content_script_apitest.cc +++ b/chrome/browser/extensions/content_script_apitest.cc @@ -88,7 +88,7 @@ IN_PROC_BROWSER_TEST_F( DISABLED_ContentScriptStylesInjectedIntoExistingRenderers) { ASSERT_TRUE(StartTestServer()); - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, content::Source<Profile>(browser()->profile())); diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc index 98bf5e2..a19a47a 100644 --- a/chrome/browser/extensions/extension_browsertest.cc +++ b/chrome/browser/extensions/extension_browsertest.cc @@ -115,7 +115,7 @@ const Extension* ExtensionBrowserTest::LoadExtensionWithOptions( // incognito disabled and file access enabled, so we don't wait in those // cases. { - ui_test_utils::WindowedNotificationObserver load_signal( + content::WindowedNotificationObserver load_signal( chrome::NOTIFICATION_EXTENSION_LOADED, content::Source<Profile>(browser()->profile())); CHECK(!service->IsIncognitoEnabled(extension_id)); @@ -129,7 +129,7 @@ const Extension* ExtensionBrowserTest::LoadExtensionWithOptions( } { - ui_test_utils::WindowedNotificationObserver load_signal( + content::WindowedNotificationObserver load_signal( chrome::NOTIFICATION_EXTENSION_LOADED, content::Source<Profile>(browser()->profile())); CHECK(service->AllowFileAccess(extension)); @@ -490,7 +490,7 @@ void ExtensionBrowserTest::OpenWindow(content::WebContents* contents, const GURL& url, bool newtab_process_should_equal_opener, content::WebContents** newtab_result) { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( @@ -518,7 +518,7 @@ void ExtensionBrowserTest::OpenWindow(content::WebContents* contents, void ExtensionBrowserTest::NavigateInRenderer(content::WebContents* contents, const GURL& url) { bool result = false; - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( diff --git a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc index 21e0d9a..e8a86b9 100644 --- a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc +++ b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc @@ -483,7 +483,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, GetExtensionService()->terminated_extensions()->size()); { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); diff --git a/chrome/browser/extensions/extension_management_apitest.cc b/chrome/browser/extensions/extension_management_apitest.cc index 5102e37..81a4347 100644 --- a/chrome/browser/extensions/extension_management_apitest.cc +++ b/chrome/browser/extensions/extension_management_apitest.cc @@ -16,7 +16,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" -#include "chrome/test/base/ui_test_utils.h" +#include "content/public/test/test_utils.h" using extensions::Extension; @@ -152,7 +152,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchPanelApp) { ASSERT_TRUE(app_browser->is_app()); // Close the app panel. - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_BROWSER_CLOSED, content::Source<Browser>(app_browser)); diff --git a/chrome/browser/extensions/extension_startup_browsertest.cc b/chrome/browser/extensions/extension_startup_browsertest.cc index 7de10c6..ede77bb 100644 --- a/chrome/browser/extensions/extension_startup_browsertest.cc +++ b/chrome/browser/extensions/extension_startup_browsertest.cc @@ -97,7 +97,7 @@ class ExtensionStartupTestBase : public InProcessBrowserTest { static_cast<uint32>(found_extensions)); ASSERT_EQ(expect_extensions_enabled, service->extensions_enabled()); - ui_test_utils::WindowedNotificationObserver user_scripts_observer( + content::WindowedNotificationObserver user_scripts_observer( chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, content::NotificationService::AllSources()); extensions::UserScriptMaster* master = @@ -185,7 +185,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionsStartupTest, MAYBE_NoFileAccess) { } for (size_t i = 0; i < extension_list.size(); ++i) { - ui_test_utils::WindowedNotificationObserver user_scripts_observer( + content::WindowedNotificationObserver user_scripts_observer( chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, content::NotificationService::AllSources()); service->SetAllowFileAccess(extension_list[i], false); diff --git a/chrome/browser/extensions/isolated_app_browsertest.cc b/chrome/browser/extensions/isolated_app_browsertest.cc index d63a6c6..cf38678 100644 --- a/chrome/browser/extensions/isolated_app_browsertest.cc +++ b/chrome/browser/extensions/isolated_app_browsertest.cc @@ -170,7 +170,7 @@ IN_PROC_BROWSER_TEST_F(IsolatedAppTest, CookieIsolation) { // Check that isolation persists even if the tab crashes and is reloaded. chrome::SelectNumberedTab(browser(), 0); ui_test_utils::CrashTab(tab1); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); diff --git a/chrome/browser/extensions/lazy_background_page_apitest.cc b/chrome/browser/extensions/lazy_background_page_apitest.cc index a15ad3d..0f03345 100644 --- a/chrome/browser/extensions/lazy_background_page_apitest.cc +++ b/chrome/browser/extensions/lazy_background_page_apitest.cc @@ -150,7 +150,7 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, BroadcastEvent) { // Open a tab to a URL that will trigger the page action to show. LazyBackgroundObserver page_complete; - ui_test_utils::WindowedNotificationObserver page_action_changed( + content::WindowedNotificationObserver page_action_changed( chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, content::NotificationService::AllSources()); ui_test_utils::NavigateToURL( diff --git a/chrome/browser/extensions/lazy_background_page_test_util.h b/chrome/browser/extensions/lazy_background_page_test_util.h index 102cff9..be6de4e 100644 --- a/chrome/browser/extensions/lazy_background_page_test_util.h +++ b/chrome/browser/extensions/lazy_background_page_test_util.h @@ -5,9 +5,9 @@ #ifndef CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_PAGE_TEST_UTIL_H_ #define CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_PAGE_TEST_UTIL_H_ -#include "content/public/browser/notification_service.h" #include "chrome/common/chrome_notification_types.h" -#include "chrome/test/base/ui_test_utils.h" +#include "content/public/browser/notification_service.h" +#include "content/public/test/test_utils.h" // Helper class to wait for a lazy background page to load and close again. class LazyBackgroundObserver { @@ -37,8 +37,8 @@ class LazyBackgroundObserver { } private: - ui_test_utils::WindowedNotificationObserver page_created_; - ui_test_utils::WindowedNotificationObserver page_closed_; + content::WindowedNotificationObserver page_created_; + content::WindowedNotificationObserver page_closed_; }; #endif // CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_PAGE_TEST_UTIL_H_ diff --git a/chrome/browser/extensions/platform_app_browsertest.cc b/chrome/browser/extensions/platform_app_browsertest.cc index 6ce75dd..23fab9b 100644 --- a/chrome/browser/extensions/platform_app_browsertest.cc +++ b/chrome/browser/extensions/platform_app_browsertest.cc @@ -306,7 +306,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, GetDisplayPath) { IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OpenLink) { ASSERT_TRUE(StartTestServer()); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_TAB_ADDED, content::Source<content::WebContentsDelegate>(browser())); LoadAndLaunchPlatformApp("open_link"); @@ -348,7 +348,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DISABLED_BrowserTagIsolation) { LoadAndLaunchPlatformApp("browser_tag_isolation"); ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); - ui_test_utils::WindowedNotificationObserver load_stop_observer( + content::WindowedNotificationObserver load_stop_observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); load_stop_observer.Wait(); diff --git a/chrome/browser/extensions/platform_app_browsertest_util.cc b/chrome/browser/extensions/platform_app_browsertest_util.cc index 474ed63..5496408 100644 --- a/chrome/browser/extensions/platform_app_browsertest_util.cc +++ b/chrome/browser/extensions/platform_app_browsertest_util.cc @@ -13,8 +13,8 @@ #include "chrome/browser/ui/extensions/application_launch.h" #include "chrome/browser/ui/extensions/shell_window.h" #include "chrome/common/chrome_switches.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/notification_service.h" +#include "content/public/test/test_utils.h" using content::WebContents; using extensions::Extension; @@ -29,7 +29,7 @@ void PlatformAppBrowserTest::SetUpCommandLine( const Extension* PlatformAppBrowserTest::LoadAndLaunchPlatformApp( const char* name) { - ui_test_utils::WindowedNotificationObserver app_loaded_observer( + content::WindowedNotificationObserver app_loaded_observer( content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, content::NotificationService::AllSources()); @@ -111,7 +111,7 @@ ShellWindow* PlatformAppBrowserTest::CreateShellWindow( } void PlatformAppBrowserTest::CloseShellWindow(ShellWindow* window) { - ui_test_utils::WindowedNotificationObserver destroyed_observer( + content::WindowedNotificationObserver destroyed_observer( content::NOTIFICATION_WEB_CONTENTS_DESTROYED, content::NotificationService::AllSources()); window->Close(); diff --git a/chrome/browser/extensions/plugin_apitest.cc b/chrome/browser/extensions/plugin_apitest.cc index 6bbc809..548663d 100644 --- a/chrome/browser/extensions/plugin_apitest.cc +++ b/chrome/browser/extensions/plugin_apitest.cc @@ -71,7 +71,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PluginLoadUnload) { ASSERT_TRUE(LoadExtension(extension_dir)); EXPECT_EQ(size_before + 1, service->extensions()->size()); { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); diff --git a/chrome/browser/fast_shutdown_browsertest.cc b/chrome/browser/fast_shutdown_browsertest.cc index 1e45db5..0a491ed 100644 --- a/chrome/browser/fast_shutdown_browsertest.cc +++ b/chrome/browser/fast_shutdown_browsertest.cc @@ -87,9 +87,9 @@ IN_PROC_BROWSER_TEST_F(FastShutdown, SlowTermination) { GURL url = test_server()->GetURL("files/fast_shutdown/on_unloader.html"); EXPECT_EQ("", GetCookies(url)); - ui_test_utils::WindowedNotificationObserver window_observer( - chrome::NOTIFICATION_BROWSER_WINDOW_READY, - content::NotificationService::AllSources()); + content::WindowedNotificationObserver window_observer( + chrome::NOTIFICATION_BROWSER_WINDOW_READY, + content::NotificationService::AllSources()); ui_test_utils::NavigateToURLWithDisposition( browser(), url, NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_NONE); window_observer.Wait(); @@ -102,9 +102,9 @@ IN_PROC_BROWSER_TEST_F(FastShutdown, SlowTermination) { // Need to wait for the renderer process to shutdown to ensure that we got the // set cookies IPC. - ui_test_utils::WindowedNotificationObserver renderer_shutdown_observer( - content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, - content::NotificationService::AllSources()); + content::WindowedNotificationObserver renderer_shutdown_observer( + content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, + content::NotificationService::AllSources()); // Close the tab. This should launch the unload handler, which sets a cookie // that's stored to disk. chrome::CloseTab(browser()); diff --git a/chrome/browser/geolocation/geolocation_browsertest.cc b/chrome/browser/geolocation/geolocation_browsertest.cc index 7d3b0d0..a2b3eaf 100644 --- a/chrome/browser/geolocation/geolocation_browsertest.cc +++ b/chrome/browser/geolocation/geolocation_browsertest.cc @@ -298,7 +298,7 @@ class GeolocationBrowserTest : public InProcessBrowserTest { ASSERT_TRUE(infobar_); LOG(WARNING) << "will set infobar response"; { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &tab_contents->web_contents()->GetController())); @@ -487,7 +487,7 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, CheckStringValueFromJavascript("1", "geoSetMaxNavigateCount(1)"); double fresh_position_latitude = 3.17; double fresh_position_longitude = 4.23; - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &chrome::GetActiveWebContents(current_browser_)->GetController())); @@ -523,7 +523,7 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, // so that it'll fetch from cache. double cached_position_latitude = 5.67; double cached_position_lognitude = 8.09; - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &chrome::GetActiveWebContents(current_browser_)->GetController())); @@ -632,7 +632,7 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, TwoWatchesInOneFrame) { // The second watch will now have cancelled. Ensure an update still makes // its way through to the first watcher. - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &chrome::GetActiveWebContents(current_browser_)->GetController())); diff --git a/chrome/browser/history/top_sites_unittest.cc b/chrome/browser/history/top_sites_unittest.cc index 8d07e50..4524f92 100644 --- a/chrome/browser/history/top_sites_unittest.cc +++ b/chrome/browser/history/top_sites_unittest.cc @@ -27,9 +27,9 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/testing_profile.h" -#include "chrome/test/base/ui_test_utils.h" #include "chrome/tools/profiles/thumbnail-inl.h" #include "content/public/test/test_browser_thread.h" +#include "content/public/test/test_utils.h" #include "googleurl/src/gurl.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -1238,7 +1238,7 @@ TEST_F(TopSitesUnloadTest, UnloadWithMigration) { profile()->BlockUntilHistoryProcessesPendingRequests(); // Create top sites and unload history. - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_TOP_SITES_LOADED, content::Source<Profile>(profile())); profile()->CreateTopSites(); diff --git a/chrome/browser/infobars/infobars_browsertest.cc b/chrome/browser/infobars/infobars_browsertest.cc index eadcb8d..81d6fdb 100644 --- a/chrome/browser/infobars/infobars_browsertest.cc +++ b/chrome/browser/infobars/infobars_browsertest.cc @@ -35,7 +35,7 @@ class InfoBarsTest : public InProcessBrowserTest { Profile* profile = browser()->profile(); ExtensionService* service = profile->GetExtensionService(); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_EXTENSION_LOADED, content::NotificationService::AllSources()); @@ -56,7 +56,7 @@ IN_PROC_BROWSER_TEST_F(InfoBarsTest, TestInfoBarsCloseOnNewTheme) { ui_test_utils::NavigateToURL( browser(), test_server()->GetURL("files/simple.html")); - ui_test_utils::WindowedNotificationObserver infobar_added_1( + content::WindowedNotificationObserver infobar_added_1( chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, content::NotificationService::AllSources()); InstallExtension("theme.crx"); @@ -65,10 +65,10 @@ IN_PROC_BROWSER_TEST_F(InfoBarsTest, TestInfoBarsCloseOnNewTheme) { ui_test_utils::NavigateToURLWithDisposition( browser(), test_server()->GetURL("files/simple.html"), NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); - ui_test_utils::WindowedNotificationObserver infobar_added_2( + content::WindowedNotificationObserver infobar_added_2( chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, content::NotificationService::AllSources()); - ui_test_utils::WindowedNotificationObserver infobar_removed_1( + content::WindowedNotificationObserver infobar_removed_1( chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, content::NotificationService::AllSources()); InstallExtension("theme2.crx"); @@ -78,7 +78,7 @@ IN_PROC_BROWSER_TEST_F(InfoBarsTest, TestInfoBarsCloseOnNewTheme) { chrome::GetTabContentsAt(browser(), 0)->infobar_tab_helper()-> infobar_count()); - ui_test_utils::WindowedNotificationObserver infobar_removed_2( + content::WindowedNotificationObserver infobar_removed_2( chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, content::NotificationService::AllSources()); ThemeServiceFactory::GetForProfile(browser()->profile())->UseDefaultTheme(); diff --git a/chrome/browser/instant/instant_browsertest.cc b/chrome/browser/instant/instant_browsertest.cc index 190af06..334eb77 100644 --- a/chrome/browser/instant/instant_browsertest.cc +++ b/chrome/browser/instant/instant_browsertest.cc @@ -63,7 +63,7 @@ class InstantTest : public InProcessBrowserTest { TemplateURLService* model = TemplateURLServiceFactory::GetForProfile(profile); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, content::NotificationService::AllSources()); if (!model->loaded()) { @@ -86,7 +86,7 @@ class InstantTest : public InProcessBrowserTest { // Type a character to get instant to trigger and determine instant support. void DetermineInstantSupport() { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_INSTANT_SUPPORT_DETERMINED, content::NotificationService::AllSources()); // "a" triggers the "about:" provider. "b" begins the "bing.com" keyword. @@ -97,7 +97,7 @@ class InstantTest : public InProcessBrowserTest { // Types "def" into the omnibox and waits for the preview to be shown. void SearchAndWaitForPreviewToShow() { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_INSTANT_CONTROLLER_SHOWN, content::NotificationService::AllSources()); omnibox()->SetUserText(ASCIIToUTF16("def")); @@ -588,7 +588,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(SearchToNonSearch)) { EnableInstant(); SetupInstantProvider("instant.html"); - ui_test_utils::WindowedNotificationObserver instant_support_observer( + content::WindowedNotificationObserver instant_support_observer( chrome::NOTIFICATION_INSTANT_SUPPORT_DETERMINED, content::NotificationService::AllSources()); @@ -629,7 +629,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(SearchServerDoesntSupportInstant)) { EnableInstant(); SetupInstantProvider("empty.html"); - ui_test_utils::WindowedNotificationObserver tab_closed_observer( + content::WindowedNotificationObserver tab_closed_observer( content::NOTIFICATION_WEB_CONTENTS_DESTROYED, content::NotificationService::AllSources()); @@ -655,7 +655,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, omnibox()->SetUserText(UTF8ToUTF16(url.spec())); EXPECT_FALSE(preview()); - ui_test_utils::WindowedNotificationObserver tab_closed_observer( + content::WindowedNotificationObserver tab_closed_observer( content::NOTIFICATION_WEB_CONTENTS_DESTROYED, content::NotificationService::AllSources()); @@ -757,7 +757,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(PreloadsInstant)) { EXPECT_FALSE(preview()); // Focusing the omnibox should cause instant to be preloaded. - ui_test_utils::WindowedNotificationObserver instant_support_observer( + content::WindowedNotificationObserver instant_support_observer( chrome::NOTIFICATION_INSTANT_SUPPORT_DETERMINED, content::NotificationService::AllSources()); browser()->window()->GetLocationBar()->FocusLocation(false); diff --git a/chrome/browser/metrics/metrics_service_browsertest.cc b/chrome/browser/metrics/metrics_service_browsertest.cc index 7050ada..c58d810 100644 --- a/chrome/browser/metrics/metrics_service_browsertest.cc +++ b/chrome/browser/metrics/metrics_service_browsertest.cc @@ -79,7 +79,7 @@ IN_PROC_BROWSER_TEST_F(MetricsServiceTest, MAYBE_CrashRenderers) { OpenTabs(); // Kill the process for one of the tabs. - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_RENDERER_PROCESS_CLOSED, content::NotificationService::AllSources()); ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUICrashURL)); diff --git a/chrome/browser/performance_monitor/performance_monitor_browsertest.cc b/chrome/browser/performance_monitor/performance_monitor_browsertest.cc index 8e57798..dedcf99 100644 --- a/chrome/browser/performance_monitor/performance_monitor_browsertest.cc +++ b/chrome/browser/performance_monitor/performance_monitor_browsertest.cc @@ -131,7 +131,7 @@ class PerformanceMonitorBrowserTest : public ExtensionBrowserTest { // If we begin the tests prior to full initialization, we cannot predict // the behavior or mock synchronicity as we must. Wait for initialization // to complete fully before proceeding with the test. - ui_test_utils::WindowedNotificationObserver windowed_observer( + content::WindowedNotificationObserver windowed_observer( chrome::NOTIFICATION_PERFORMANCE_MONITOR_INITIALIZED, content::NotificationService::AllSources()); @@ -288,7 +288,7 @@ IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, UpdateExtensionEvent) { CrxInstaller* crx_installer = NULL; // Create an observer to wait for the update to finish. - ui_test_utils::WindowedNotificationObserver windowed_observer( + content::WindowedNotificationObserver windowed_observer( chrome::NOTIFICATION_CRX_INSTALLER_DONE, content::Source<CrxInstaller>(crx_installer)); ASSERT_TRUE(extension_service-> diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc index d3b15c2..7ac63bb 100644 --- a/chrome/browser/prerender/prerender_browsertest.cc +++ b/chrome/browser/prerender/prerender_browsertest.cc @@ -48,8 +48,8 @@ #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/url_constants.h" -#include "content/public/test/browser_test_utils.h" #include "content/public/test/test_navigation_observer.h" +#include "content/public/test/test_utils.h" #include "grit/generated_resources.h" #include "net/base/mock_host_resolver.h" #include "net/url_request/url_request_context.h" @@ -670,7 +670,7 @@ class PrerenderBrowserTest : virtual public InProcessBrowserTest { } void ClickToNextPageAfterPrerender() { - ui_test_utils::WindowedNotificationObserver new_page_observer( + content::WindowedNotificationObserver new_page_observer( content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::NotificationService::AllSources()); RenderViewHost* render_view_host = @@ -699,7 +699,7 @@ class PrerenderBrowserTest : virtual public InProcessBrowserTest { // Called after the prerendered page has been navigated to and then away from. // Navigates back through the history to the prerendered page. void GoBackToPrerender() { - ui_test_utils::WindowedNotificationObserver back_nav_observer( + content::WindowedNotificationObserver back_nav_observer( content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::NotificationService::AllSources()); chrome::GoBack(current_browser(), CURRENT_TAB); @@ -719,7 +719,7 @@ class PrerenderBrowserTest : virtual public InProcessBrowserTest { WebContents* tab = chrome::GetActiveWebContents(current_browser()); ASSERT_TRUE(tab); EXPECT_FALSE(tab->IsLoading()); - ui_test_utils::WindowedNotificationObserver back_nav_observer( + content::WindowedNotificationObserver back_nav_observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>(&tab->GetController())); chrome::GoBack(current_browser(), CURRENT_TAB); @@ -896,7 +896,7 @@ class PrerenderBrowserTest : virtual public InProcessBrowserTest { // page has finished loading before continuing. This prevents ambiguous // NOTIFICATION_LOAD_STOP events from making tests flaky. WebContents* web_contents = chrome::GetActiveWebContents(current_browser()); - ui_test_utils::WindowedNotificationObserver loader_nav_observer( + content::WindowedNotificationObserver loader_nav_observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &web_contents->GetController())); @@ -954,7 +954,7 @@ class PrerenderBrowserTest : virtual public InProcessBrowserTest { if (disposition == NEW_BACKGROUND_TAB) GetPrerenderContents()->set_should_be_shown(false); - scoped_ptr<ui_test_utils::WindowedNotificationObserver> page_load_observer; + scoped_ptr<content::WindowedNotificationObserver> page_load_observer; WebContents* web_contents = NULL; if (GetPrerenderContents()->prerender_contents()) { @@ -964,7 +964,7 @@ class PrerenderBrowserTest : virtual public InProcessBrowserTest { GetPrerenderContents()->prerender_contents()->web_contents(); if (GetPrerenderContents()->number_of_loads() == 0) { page_load_observer.reset( - new ui_test_utils::WindowedNotificationObserver( + new content::WindowedNotificationObserver( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &web_contents->GetController()))); @@ -2095,7 +2095,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderFavicon) { 1); TestPrerenderContents* prerender_contents = GetPrerenderContents(); ASSERT_TRUE(prerender_contents != NULL); - ui_test_utils::WindowedNotificationObserver favicon_update_watcher( + content::WindowedNotificationObserver favicon_update_watcher( chrome::NOTIFICATION_FAVICON_UPDATED, content::Source<WebContents>(prerender_contents->prerender_contents()-> web_contents())); diff --git a/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc b/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc index 36195c8..1a3bfa9 100644 --- a/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc +++ b/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc @@ -249,7 +249,7 @@ IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, MAYBE_HandlersRegistered) { ASSERT_TRUE(TestController::GetInstance()->result()); // Close the dialog before finishing the test. - ui_test_utils::WindowedNotificationObserver tab_closed_observer( + content::WindowedNotificationObserver tab_closed_observer( content::NOTIFICATION_WEB_CONTENTS_DESTROYED, content::NotificationService::AllSources()); diff --git a/chrome/browser/printing/print_preview_tab_controller_browsertest.cc b/chrome/browser/printing/print_preview_tab_controller_browsertest.cc index 427691c..b2d8442 100644 --- a/chrome/browser/printing/print_preview_tab_controller_browsertest.cc +++ b/chrome/browser/printing/print_preview_tab_controller_browsertest.cc @@ -119,7 +119,7 @@ IN_PROC_BROWSER_TEST_F(PrintPreviewTabControllerBrowserTest, TabDestroyedObserver tab_destroyed_observer(preview_tab->web_contents()); // Reload the initiator tab. - ui_test_utils::WindowedNotificationObserver notification_observer( + content::WindowedNotificationObserver notification_observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::Reload(browser(), CURRENT_TAB); diff --git a/chrome/browser/profiles/profile_browsertest.cc b/chrome/browser/profiles/profile_browsertest.cc index eb5cf21..752f253 100644 --- a/chrome/browser/profiles/profile_browsertest.cc +++ b/chrome/browser/profiles/profile_browsertest.cc @@ -99,7 +99,7 @@ IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, CreateNewProfileAsynchronous) { ASSERT_TRUE(profile.get()); // Wait for the profile to be created. - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_PROFILE_CREATED, content::Source<Profile>(profile.get())); observer.Wait(); @@ -120,7 +120,7 @@ IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, CreateOldProfileAsynchronous) { ASSERT_TRUE(profile.get()); // Wait for the profile to be created. - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_PROFILE_CREATED, content::Source<Profile>(profile.get())); observer.Wait(); @@ -143,7 +143,7 @@ IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, ProfileReadmeCreated) { ASSERT_TRUE(profile.get()); // Wait for the profile to be created. - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_PROFILE_CREATED, content::Source<Profile>(profile.get())); observer.Wait(); diff --git a/chrome/browser/profiles/profile_info_cache_unittest.cc b/chrome/browser/profiles/profile_info_cache_unittest.cc index 7523669..61f1c10 100644 --- a/chrome/browser/profiles/profile_info_cache_unittest.cc +++ b/chrome/browser/profiles/profile_info_cache_unittest.cc @@ -12,10 +12,10 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_pref_service.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_service.h" +#include "content/public/test/test_utils.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image.h" @@ -369,7 +369,7 @@ TEST_F(ProfileInfoCacheTest, PersistGAIAPicture) { GetProfilePath("path_1"), ASCIIToUTF16("name_1"), string16(), 0); gfx::Image gaia_image(gfx::test::CreateImage()); - ui_test_utils::WindowedNotificationObserver save_observer( + content::WindowedNotificationObserver save_observer( chrome::NOTIFICATION_PROFILE_CACHE_PICTURE_SAVED, content::NotificationService::AllSources()); GetCache()->SetGAIAPictureOfProfileAtIndex(0, &gaia_image); @@ -382,7 +382,7 @@ TEST_F(ProfileInfoCacheTest, PersistGAIAPicture) { // Try to get the GAIA picture. This should return NULL until the read from // disk is done. - ui_test_utils::WindowedNotificationObserver read_observer( + content::WindowedNotificationObserver read_observer( chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, content::NotificationService::AllSources()); EXPECT_EQ(NULL, GetCache()->GetGAIAPictureOfProfileAtIndex(0)); diff --git a/chrome/browser/repost_form_warning_browsertest.cc b/chrome/browser/repost_form_warning_browsertest.cc index 36025f0..cf12df5 100644 --- a/chrome/browser/repost_form_warning_browsertest.cc +++ b/chrome/browser/repost_form_warning_browsertest.cc @@ -71,7 +71,7 @@ IN_PROC_BROWSER_TEST_F(RepostFormWarningTest, TestLoginAfterRepost) { // Navigate to a page that requires authentication, bringing up another // tab-modal sheet. content::NavigationController& controller = web_contents->GetController(); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_AUTH_NEEDED, content::Source<content::NavigationController>(&controller)); browser()->OpenURL(content::OpenURLParams( diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc index 2177836..4c9a7a9 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc @@ -320,9 +320,9 @@ class SafeBrowsingBlockingPageTest : public InProcessBrowserTest { void WaitForInterstitial() { WebContents* contents = chrome::GetActiveWebContents(browser()); - ui_test_utils::WindowedNotificationObserver interstitial_observer( - content::NOTIFICATION_INTERSTITIAL_ATTACHED, - content::Source<WebContents>(contents)); + content::WindowedNotificationObserver interstitial_observer( + content::NOTIFICATION_INTERSTITIAL_ATTACHED, + content::Source<WebContents>(contents)); if (!InterstitialPage::GetInterstitialPage(contents)) interstitial_observer.Wait(); } @@ -455,7 +455,7 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareProceed) { // Note: NOTIFICATION_LOAD_STOP may come before or after the DidNavigate // event that clears the interstitial. We wait for DidNavigate instead. ui_test_utils::NavigateToURL(browser(), url); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); @@ -486,7 +486,7 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingProceed) { // Note: NOTIFICATION_LOAD_STOP may come before or after the DidNavigate // event that clears the interstitial. We wait for DidNavigate instead. - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); @@ -504,7 +504,7 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingReportError) { // Note: NOTIFICATION_LOAD_STOP may come before or after the DidNavigate // event that clears the interstitial. We wait for DidNavigate instead. - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); @@ -527,7 +527,7 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, // Note: NOTIFICATION_LOAD_STOP may come before or after the DidNavigate // event that clears the interstitial. We wait for DidNavigate instead. - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); @@ -548,7 +548,7 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareIframeDontProceed) { ui_test_utils::NavigateToURL(browser(), url); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); diff --git a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc index 6f78a50..7ce93f7 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc @@ -875,7 +875,7 @@ class SafeBrowsingServiceCookieTest : public InProcessBrowserTest { // Test that a Safe Browsing database update request both sends cookies and can // save cookies. IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceCookieTest, TestSBUpdateCookies) { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, content::Source<SafeBrowsingService>(sb_service_.get())); BrowserThread::PostTask( diff --git a/chrome/browser/sessions/session_restore_browsertest.cc b/chrome/browser/sessions/session_restore_browsertest.cc index e569853..8528a14 100644 --- a/chrome/browser/sessions/session_restore_browsertest.cc +++ b/chrome/browser/sessions/session_restore_browsertest.cc @@ -88,7 +88,7 @@ class SessionRestoreTest : public InProcessBrowserTest { } void CloseBrowserSynchronously(Browser* browser) { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_BROWSER_CLOSED, content::NotificationService::AllSources()); browser->window()->Close(); @@ -121,7 +121,7 @@ class SessionRestoreTest : public InProcessBrowserTest { } void GoBack(Browser* browser) { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::GoBack(browser, CURRENT_TAB); @@ -129,7 +129,7 @@ class SessionRestoreTest : public InProcessBrowserTest { } void GoForward(Browser* browser) { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::GoForward(browser, CURRENT_TAB); @@ -263,7 +263,7 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoreIndividualTabFromWindow) { // Add and navigate three tabs. ui_test_utils::NavigateToURL(browser(), url1); { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::AddSelectedTabWithURL(browser(), url2, @@ -271,7 +271,7 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoreIndividualTabFromWindow) { observer.Wait(); } { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::AddSelectedTabWithURL(browser(), url3, @@ -394,7 +394,7 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoreForeignTab) { // Restore in the current tab. { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); SessionRestore::RestoreForeignSessionTab( @@ -407,7 +407,7 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoreForeignTab) { // Restore in a new tab. { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); SessionRestore::RestoreForeignSessionTab( diff --git a/chrome/browser/sessions/tab_restore_service_browsertest.cc b/chrome/browser/sessions/tab_restore_service_browsertest.cc index 31d9167..5785d21 100644 --- a/chrome/browser/sessions/tab_restore_service_browsertest.cc +++ b/chrome/browser/sessions/tab_restore_service_browsertest.cc @@ -16,7 +16,6 @@ #include "chrome/test/base/chrome_render_view_test.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/testing_profile.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" @@ -24,6 +23,7 @@ #include "content/public/browser/notification_types.h" #include "content/public/test/render_view_test.h" #include "content/public/test/test_browser_thread.h" +#include "content/public/test/test_utils.h" #include "content/public/test/web_contents_tester.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" @@ -275,7 +275,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreServiceBrowserTest, RestoreApp) { Browser* app_browser = CreateBrowserForApp(app_name, profile); app_browser->window()->Close(); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_BROWSER_CLOSED, content::Source<Browser>(app_browser)); observer.Wait(); diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc index 99de039..7b95adf 100644 --- a/chrome/browser/ssl/ssl_browser_tests.cc +++ b/chrome/browser/ssl/ssl_browser_tests.cc @@ -190,7 +190,7 @@ class SSLUITest : public InProcessBrowserTest { void ProceedThroughInterstitial(WebContents* tab) { InterstitialPage* interstitial_page = tab->GetInterstitialPage(); ASSERT_TRUE(interstitial_page); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>(&tab->GetController())); interstitial_page->Proceed(); @@ -486,7 +486,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndGoForward) { // Now go back so that a page is in the forward history. { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>(&tab->GetController())); tab->GetController().GoBack(); @@ -504,7 +504,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndGoForward) { // Simulate user clicking and holding on forward button. { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>(&tab->GetController())); tab->GetController().GoToOffset(1); @@ -638,7 +638,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestBadHTTPSDownload) { // Now, start a transition to dangerous download. { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::NavigateParams navigate_params(browser(), url_dangerous, @@ -653,7 +653,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestBadHTTPSDownload) { ASSERT_TRUE(tab != NULL); ASSERT_TRUE(tab->GetInterstitialPage() != NULL); { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_DOWNLOAD_INITIATED, content::NotificationService::AllSources()); tab->GetInterstitialPage()->Proceed(); @@ -804,7 +804,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentTwoTabs) { params.disposition = NEW_FOREGROUND_TAB; params.tabstrip_index = 0; params.source_contents = tab1; - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::Navigate(¶ms); @@ -846,7 +846,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsInsecureContentTwoTabs) { chrome::NavigateParams params(browser(), url, content::PAGE_TRANSITION_TYPED); params.disposition = NEW_FOREGROUND_TAB; params.source_contents = tab1; - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::Navigate(¶ms); @@ -1025,7 +1025,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestCloseTabWithUnsafePopup) { // Let's add another tab to make sure the browser does not exit when we close // the first tab. GURL url = test_server()->GetURL("files/ssl/google.html"); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::AddSelectedTabWithURL(browser(), url, content::PAGE_TRANSITION_TYPED); @@ -1167,7 +1167,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestGoodFrameNavigation) { bool success = false; // Now navigate inside the frame. { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>(&tab->GetController())); EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( @@ -1183,7 +1183,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestGoodFrameNavigation) { // Now let's hit a bad page. { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>(&tab->GetController())); EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( @@ -1209,7 +1209,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestGoodFrameNavigation) { // Now go back, our state should still be OK. { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>(&tab->GetController())); tab->GetController().GoBack(); @@ -1219,7 +1219,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestGoodFrameNavigation) { // Navigate to a page served over HTTP. { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>(&tab->GetController())); EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( @@ -1235,7 +1235,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestGoodFrameNavigation) { // Go back, our state should be unchanged. { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>(&tab->GetController())); tab->GetController().GoBack(); @@ -1266,7 +1266,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadFrameNavigation) { // Navigate to a good frame. bool success = false; - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>(&tab->GetController())); EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( @@ -1303,7 +1303,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestUnauthenticatedFrameNavigation) { // Now navigate inside the frame to a secure HTTPS frame. { bool success = false; - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>(&tab->GetController())); EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( @@ -1320,7 +1320,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestUnauthenticatedFrameNavigation) { // Now navigate to a bad HTTPS frame. { bool success = false; - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>(&tab->GetController())); EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( diff --git a/chrome/browser/tab_restore_browsertest.cc b/chrome/browser/tab_restore_browsertest.cc index 5beeaba..b46342a 100644 --- a/chrome/browser/tab_restore_browsertest.cc +++ b/chrome/browser/tab_restore_browsertest.cc @@ -65,9 +65,9 @@ class TabRestoreTest : public InProcessBrowserTest { void CloseTab(int index) { content::WebContents* new_tab = chrome::GetWebContentsAt(browser(), index); - ui_test_utils::WindowedNotificationObserver tab_close_observer( - content::NOTIFICATION_WEB_CONTENTS_DESTROYED, - content::NotificationService::AllSources()); + content::WindowedNotificationObserver tab_close_observer( + content::NOTIFICATION_WEB_CONTENTS_DESTROYED, + content::NotificationService::AllSources()); chrome::CloseWebContents(browser(), new_tab); tab_close_observer.Wait(); } @@ -95,12 +95,12 @@ class TabRestoreTest : public InProcessBrowserTest { ASSERT_GT(tab_count, 0); // Restore the tab. - ui_test_utils::WindowedNotificationObserver tab_added_observer( - chrome::NOTIFICATION_TAB_PARENTED, - content::NotificationService::AllSources()); - ui_test_utils::WindowedNotificationObserver tab_loaded_observer( - content::NOTIFICATION_LOAD_STOP, - content::NotificationService::AllSources()); + content::WindowedNotificationObserver tab_added_observer( + chrome::NOTIFICATION_TAB_PARENTED, + content::NotificationService::AllSources()); + content::WindowedNotificationObserver tab_loaded_observer( + content::NOTIFICATION_LOAD_STOP, + content::NotificationService::AllSources()); chrome::RestoreTab(browser); tab_added_observer.Wait(); tab_loaded_observer.Wait(); @@ -121,7 +121,7 @@ class TabRestoreTest : public InProcessBrowserTest { } void GoBack(Browser* browser) { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::GoBack(browser, CURRENT_TAB); @@ -134,7 +134,7 @@ class TabRestoreTest : public InProcessBrowserTest { !controller->GetWebContents()->IsLoading()) return; - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<content::NavigationController>(controller)); observer.Wait(); @@ -225,7 +225,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, FLAKY_BasicRestoreFromClosedWindow) { EXPECT_EQ(2u, BrowserList::size()); // Close the final tab in the first browser. - ui_test_utils::WindowedNotificationObserver window_observer( + content::WindowedNotificationObserver window_observer( chrome::NOTIFICATION_BROWSER_CLOSED, content::NotificationService::AllSources()); CloseTab(0); @@ -279,7 +279,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWindowAndTab) { EXPECT_EQ(2u, BrowserList::size()); // Close the first browser. - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_BROWSER_CLOSED, content::NotificationService::AllSources()); chrome::CloseWindow(browser()); @@ -320,7 +320,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreIntoSameWindow) { CloseTab(0); // Close the last tab, closing the browser. - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_BROWSER_CLOSED, content::NotificationService::AllSources()); CloseTab(0); @@ -357,7 +357,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWithExistingSiteInstance) { // Navigate to another same-site URL. content::WebContents* tab = chrome::GetWebContentsAt(browser(), tab_count - 1); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); static_cast<content::WebContentsDelegate*>(browser())->OpenURLFromTab( @@ -459,7 +459,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWindow) { ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); // Close the window. - ui_test_utils::WindowedNotificationObserver close_window_observer( + content::WindowedNotificationObserver close_window_observer( chrome::NOTIFICATION_BROWSER_CLOSED, content::NotificationService::AllSources()); chrome::CloseWindow(browser()); @@ -467,10 +467,10 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWindow) { EXPECT_EQ(window_count - 1, BrowserList::size()); // Restore the window. - ui_test_utils::WindowedNotificationObserver open_window_observer( + content::WindowedNotificationObserver open_window_observer( chrome::NOTIFICATION_BROWSER_OPENED, content::NotificationService::AllSources()); - ui_test_utils::WindowedNotificationObserver load_stop_observer( + content::WindowedNotificationObserver load_stop_observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::RestoreTab(*BrowserList::begin()); diff --git a/chrome/browser/task_manager/task_manager_browsertest.cc b/chrome/browser/task_manager/task_manager_browsertest.cc index 8b5fc64..d1747395 100644 --- a/chrome/browser/task_manager/task_manager_browsertest.cc +++ b/chrome/browser/task_manager/task_manager_browsertest.cc @@ -214,7 +214,7 @@ IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, KillBGContents) { GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), FilePath(kTitle1File))); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED, content::Source<Profile>(browser()->profile())); @@ -368,7 +368,7 @@ IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeHostedAppTabs) { // Open a new tab to an app URL before the app is loaded. GURL url(base_url.Resolve("path1/empty.html")); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::NotificationService::AllSources()); AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); diff --git a/chrome/browser/task_manager/task_manager_browsertest_util.cc b/chrome/browser/task_manager/task_manager_browsertest_util.cc index 742301d..d8b2cfb 100644 --- a/chrome/browser/task_manager/task_manager_browsertest_util.cc +++ b/chrome/browser/task_manager/task_manager_browsertest_util.cc @@ -74,7 +74,7 @@ void TaskManagerBrowserTestUtil::WaitForResourceChange(int target_count) { void TaskManagerBrowserTestUtil::ShowTaskManagerAndWaitForReady( Browser* browser) { #if defined(USE_AURA) - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_TASK_MANAGER_WINDOW_READY, content::Source<TaskManagerModel>(TaskManager::GetInstance()->model())); browser->window()->ShowTaskManager(); diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index de6a5ce..ab9ae08 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -342,7 +342,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CancelBeforeUnloadResetsURL) { browser()->OpenURL(OpenURLParams( url2, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); - ui_test_utils::WindowedNotificationObserver host_destroyed_observer( + content::WindowedNotificationObserver host_destroyed_observer( content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, content::NotificationService::AllSources()); @@ -464,12 +464,12 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { redirect_popup += https_url.spec(); redirect_popup += "\";"; - ui_test_utils::WindowedNotificationObserver popup_observer( - chrome::NOTIFICATION_TAB_ADDED, - content::NotificationService::AllSources()); - ui_test_utils::WindowedNotificationObserver nav_observer( - content::NOTIFICATION_NAV_ENTRY_COMMITTED, - content::NotificationService::AllSources()); + content::WindowedNotificationObserver popup_observer( + chrome::NOTIFICATION_TAB_ADDED, + content::NotificationService::AllSources()); + content::WindowedNotificationObserver nav_observer( + content::NOTIFICATION_NAV_ENTRY_COMMITTED, + content::NotificationService::AllSources()); oldtab->GetRenderViewHost()-> ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(redirect_popup)); @@ -498,12 +498,12 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { refresh_popup += https_url.spec(); refresh_popup += "\">');w.document.close();"; - ui_test_utils::WindowedNotificationObserver popup_observer2( - chrome::NOTIFICATION_TAB_ADDED, - content::NotificationService::AllSources()); - ui_test_utils::WindowedNotificationObserver nav_observer2( - content::NOTIFICATION_NAV_ENTRY_COMMITTED, - content::NotificationService::AllSources()); + content::WindowedNotificationObserver popup_observer2( + chrome::NOTIFICATION_TAB_ADDED, + content::NotificationService::AllSources()); + content::WindowedNotificationObserver nav_observer2( + content::NOTIFICATION_NAV_ENTRY_COMMITTED, + content::NotificationService::AllSources()); oldtab->GetRenderViewHost()-> ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(refresh_popup)); @@ -552,12 +552,12 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, OtherRedirectsDontForkProcess) { dont_fork_popup += https_url.spec(); dont_fork_popup += "\";"; - ui_test_utils::WindowedNotificationObserver popup_observer( - chrome::NOTIFICATION_TAB_ADDED, - content::NotificationService::AllSources()); - ui_test_utils::WindowedNotificationObserver nav_observer( - content::NOTIFICATION_NAV_ENTRY_COMMITTED, - content::NotificationService::AllSources()); + content::WindowedNotificationObserver popup_observer( + chrome::NOTIFICATION_TAB_ADDED, + content::NotificationService::AllSources()); + content::WindowedNotificationObserver nav_observer( + content::NOTIFICATION_NAV_ENTRY_COMMITTED, + content::NotificationService::AllSources()); oldtab->GetRenderViewHost()-> ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(dont_fork_popup)); @@ -582,7 +582,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, OtherRedirectsDontForkProcess) { navigate_str += https_url.spec(); navigate_str += "\";"; - ui_test_utils::WindowedNotificationObserver nav_observer2( + content::WindowedNotificationObserver nav_observer2( content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::NotificationService::AllSources()); oldtab->GetRenderViewHost()-> @@ -1078,7 +1078,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ForwardDisabledOnForward) { ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), FilePath(kTitle1File))); - ui_test_utils::WindowedNotificationObserver back_nav_load_observer( + content::WindowedNotificationObserver back_nav_load_observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); @@ -1088,7 +1088,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ForwardDisabledOnForward) { browser()->command_controller()->command_updater(); EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_FORWARD)); - ui_test_utils::WindowedNotificationObserver forward_nav_load_observer( + content::WindowedNotificationObserver forward_nav_load_observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); @@ -1229,7 +1229,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, PageZoom) { WebContents* contents = chrome::GetActiveWebContents(browser()); bool enable_plus, enable_minus; - ui_test_utils::WindowedNotificationObserver zoom_in_observer( + content::WindowedNotificationObserver zoom_in_observer( content::NOTIFICATION_ZOOM_LEVEL_CHANGED, content::NotificationService::AllSources()); chrome::Zoom(browser(), content::PAGE_ZOOM_IN); @@ -1238,7 +1238,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, PageZoom) { EXPECT_TRUE(enable_plus); EXPECT_TRUE(enable_minus); - ui_test_utils::WindowedNotificationObserver zoom_reset_observer( + content::WindowedNotificationObserver zoom_reset_observer( content::NOTIFICATION_ZOOM_LEVEL_CHANGED, content::NotificationService::AllSources()); chrome::Zoom(browser(), content::PAGE_ZOOM_RESET); @@ -1247,7 +1247,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, PageZoom) { EXPECT_TRUE(enable_plus); EXPECT_TRUE(enable_minus); - ui_test_utils::WindowedNotificationObserver zoom_out_observer( + content::WindowedNotificationObserver zoom_out_observer( content::NOTIFICATION_ZOOM_LEVEL_CHANGED, content::NotificationService::AllSources()); chrome::Zoom(browser(), content::PAGE_ZOOM_OUT); @@ -1276,7 +1276,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialCommandDisable) { TestInterstitialPage* interstitial = new TestInterstitialPage( contents, false, GURL()); - ui_test_utils::WindowedNotificationObserver interstitial_observer( + content::WindowedNotificationObserver interstitial_observer( content::NOTIFICATION_INTERSTITIAL_ATTACHED, content::Source<WebContents>(contents)); interstitial_observer.Wait(); @@ -1288,7 +1288,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialCommandDisable) { EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SAVE_PAGE)); EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_ENCODING_MENU)); - ui_test_utils::WindowedNotificationObserver interstitial_detach_observer( + content::WindowedNotificationObserver interstitial_detach_observer( content::NOTIFICATION_INTERSTITIAL_DETACHED, content::Source<WebContents>(contents)); interstitial->Proceed(); @@ -1535,7 +1535,7 @@ IN_PROC_BROWSER_TEST_F(RunInBackgroundTest, RunInBackgroundBasicTest) { // running. Profile* profile = browser()->profile(); EXPECT_EQ(1u, BrowserList::size()); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_BROWSER_CLOSED, content::Source<Browser>(browser())); chrome::CloseWindow(browser()); diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc index e6e4e0e..6e4cc23 100644 --- a/chrome/browser/ui/browser_navigator_browsertest.cc +++ b/chrome/browser/ui/browser_navigator_browsertest.cc @@ -903,7 +903,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, content::PAGE_TRANSITION_AUTO_BOOKMARK); params.disposition = OFF_THE_RECORD; { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::Navigate(¶ms); @@ -988,7 +988,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NavigateFromDefaultToOptionsInSameTab) { { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::ShowSettings(browser()); @@ -1006,7 +1006,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, ui_test_utils::NavigateToURL(&p); { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::ShowSettings(browser()); @@ -1027,7 +1027,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, chrome::GetActiveWebContents(browser())->GetURL()); { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::ShowSettings(browser()); @@ -1047,7 +1047,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, EXPECT_EQ(1, browser()->tab_count()); { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::ShowSettings(browser()); @@ -1061,7 +1061,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NavigateFromNTPToOptionsSingleton) { { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::ShowSettings(browser()); @@ -1073,7 +1073,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, EXPECT_EQ(2, browser()->tab_count()); { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::ShowSettings(browser()); @@ -1087,7 +1087,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NavigateFromNTPToOptionsPageInSameTab) { { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::ShowClearBrowsingDataDialog(browser()); @@ -1101,7 +1101,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, EXPECT_EQ(2, browser()->tab_count()); { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::ShowClearBrowsingDataDialog(browser()); @@ -1122,14 +1122,14 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, MAYBE_NavigateFromOtherTabToSingletonOptions) { { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::ShowSettings(browser()); observer.Wait(); } { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::AddSelectedTabWithURL(browser(), GetGoogleURL(), @@ -1138,7 +1138,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, } { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::ShowSettings(browser()); @@ -1190,7 +1190,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, DISABLED_NavigateFromDefaultToHistoryInSameTab) { { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::ShowHistory(browser()); @@ -1204,7 +1204,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NavigateFromDefaultToBookmarksInSameTab) { { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::ShowBookmarkManager(browser()); @@ -1218,7 +1218,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NavigateFromDefaultToDownloadsInSameTab) { { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::ShowDownloads(browser()); diff --git a/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm b/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm index de0b8c4..66dc242 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm @@ -17,8 +17,8 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/notification_service.h" +#include "content/public/test/test_utils.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util_mac.h" @@ -668,7 +668,7 @@ static bool IsFrontWindow(NSWindow *window) { } void WaitForFullScreenTransition() { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_FULLSCREEN_CHANGED, content::NotificationService::AllSources()); observer.Wait(); diff --git a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm index 2f4ba5f..c8fcafd 100644 --- a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm @@ -12,10 +12,10 @@ #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/chrome_notification_types.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/site_instance.h" #include "content/public/browser/web_contents.h" +#include "content/public/test/test_utils.h" #include "ipc/ipc_message.h" #include "testing/gtest_mac.h" #include "ui/base/accelerators/accelerator_cocoa.h" @@ -88,7 +88,7 @@ TEST_F(FullscreenExitBubbleControllerTest, DenyExitsFullscreen) { WebContents* fullscreen_tab = chrome::GetActiveWebContents(browser()); { base::mac::ScopedNSAutoreleasePool pool; - ui_test_utils::WindowedNotificationObserver fullscreen_observer( + content::WindowedNotificationObserver fullscreen_observer( chrome::NOTIFICATION_FULLSCREEN_CHANGED, content::NotificationService::AllSources()); browser()->ToggleFullscreenModeForTab(fullscreen_tab, true); @@ -99,7 +99,7 @@ TEST_F(FullscreenExitBubbleControllerTest, DenyExitsFullscreen) { FullscreenExitBubbleController* bubble = [bwc fullscreenExitBubbleController]; EXPECT_TRUE(bubble); { - ui_test_utils::WindowedNotificationObserver fullscreen_observer( + content::WindowedNotificationObserver fullscreen_observer( chrome::NOTIFICATION_FULLSCREEN_CHANGED, content::NotificationService::AllSources()); [bubble deny:nil]; diff --git a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc index 18c39b0..93bf210 100644 --- a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc +++ b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc @@ -635,7 +635,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindDisappearOnNavigate) { EXPECT_TRUE(fully_visible); // Reload the tab and make sure Find window doesn't go away. - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &chrome::GetActiveTabContents(browser())->web_contents()-> @@ -1127,7 +1127,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_NoIncognitoPrepopulate) { // Open a new incognito window and navigate to the same page. Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); Browser* incognito_browser = Browser::Create(incognito_profile); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::AddSelectedTabWithURL(incognito_browser, url, @@ -1173,7 +1173,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, ActivateLinkNavigatesPage) { EXPECT_EQ(ordinal, 1); // End the find session, click on the link. - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &tab->web_contents()->GetController())); @@ -1193,7 +1193,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_FitWindow) { Browser::CreateParams params(Browser::TYPE_POPUP, browser()->profile()); params.initial_bounds = gfx::Rect(0, 0, 250, 500); Browser* popup = Browser::CreateWithParams(params); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::AddSelectedTabWithURL(popup, GURL(chrome::kAboutBlankURL), diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller_interactive_browsertest.cc b/chrome/browser/ui/fullscreen/fullscreen_controller_interactive_browsertest.cc index 0af68de..116ad7b 100644 --- a/chrome/browser/ui/fullscreen/fullscreen_controller_interactive_browsertest.cc +++ b/chrome/browser/ui/fullscreen/fullscreen_controller_interactive_browsertest.cc @@ -6,6 +6,7 @@ #include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/fullscreen/fullscreen_controller_test.h" +#include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/web_contents.h" diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller_test.h b/chrome/browser/ui/fullscreen/fullscreen_controller_test.h index 83e80a8..08a3a40 100644 --- a/chrome/browser/ui/fullscreen/fullscreen_controller_test.h +++ b/chrome/browser/ui/fullscreen/fullscreen_controller_test.h @@ -8,12 +8,12 @@ #include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/test/base/in_process_browser_test.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/notification_service.h" +#include "content/public/test/test_utils.h" // Observer for NOTIFICATION_FULLSCREEN_CHANGED notifications. class FullscreenNotificationObserver - : public ui_test_utils::WindowedNotificationObserver { + : public content::WindowedNotificationObserver { public: FullscreenNotificationObserver() : WindowedNotificationObserver( chrome::NOTIFICATION_FULLSCREEN_CHANGED, @@ -24,7 +24,7 @@ class FullscreenNotificationObserver // Observer for NOTIFICATION_MOUSE_LOCK_CHANGED notifications. class MouseLockNotificationObserver - : public ui_test_utils::WindowedNotificationObserver { + : public content::WindowedNotificationObserver { public: MouseLockNotificationObserver() : WindowedNotificationObserver( chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, diff --git a/chrome/browser/ui/login/login_prompt_browsertest.cc b/chrome/browser/ui/login/login_prompt_browsertest.cc index 776332a..cb843cb 100644 --- a/chrome/browser/ui/login/login_prompt_browsertest.cc +++ b/chrome/browser/ui/login/login_prompt_browsertest.cc @@ -163,10 +163,10 @@ void LoginPromptBrowserTestObserver::Register( template <int T> class WindowedNavigationObserver - : public ui_test_utils::WindowedNotificationObserver { + : public content::WindowedNotificationObserver { public: explicit WindowedNavigationObserver(NavigationController* controller) - : ui_test_utils::WindowedNotificationObserver( + : content::WindowedNotificationObserver( T, content::Source<NavigationController>(controller)) {} }; diff --git a/chrome/browser/ui/panels/base_panel_browser_test.cc b/chrome/browser/ui/panels/base_panel_browser_test.cc index ad0bd63..486716c 100644 --- a/chrome/browser/ui/panels/base_panel_browser_test.cc +++ b/chrome/browser/ui/panels/base_panel_browser_test.cc @@ -253,7 +253,7 @@ void BasePanelBrowserTest::WaitForPanelActiveState( void BasePanelBrowserTest::WaitForWindowSizeAvailable(Panel* panel) { scoped_ptr<NativePanelTesting> panel_testing( CreateNativePanelTesting(panel)); - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_PANEL_WINDOW_SIZE_KNOWN, content::Source<Panel>(panel)); if (panel_testing->IsWindowSizeKnown()) @@ -265,7 +265,7 @@ void BasePanelBrowserTest::WaitForWindowSizeAvailable(Panel* panel) { void BasePanelBrowserTest::WaitForBoundsAnimationFinished(Panel* panel) { scoped_ptr<NativePanelTesting> panel_testing( CreateNativePanelTesting(panel)); - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, content::Source<Panel>(panel)); if (!panel_testing->IsAnimatingBounds()) @@ -276,7 +276,7 @@ void BasePanelBrowserTest::WaitForBoundsAnimationFinished(Panel* panel) { void BasePanelBrowserTest::WaitForExpansionStateChanged( Panel* panel, Panel::ExpansionState expansion_state) { - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE, content::Source<Panel>(panel)); if (panel->expansion_state() == expansion_state) @@ -297,7 +297,7 @@ Panel* BasePanelBrowserTest::CreatePanelWithParams( base::mac::ScopedNSAutoreleasePool autorelease_pool; #endif - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); @@ -436,7 +436,7 @@ void BasePanelBrowserTest::CloseWindowAndWait(Panel* panel) { // message pump and wait for the notification. PanelManager* manager = PanelManager::GetInstance(); int panel_count = manager->num_panels(); - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_PANEL_CLOSED, content::Source<Panel>(panel)); panel->Close(); @@ -459,7 +459,7 @@ void BasePanelBrowserTest::CloseWindowAndWait(Panel* panel) { void BasePanelBrowserTest::MoveMouseAndWaitForExpansionStateChange( Panel* panel, const gfx::Point& position) { - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE, content::Source<Panel>(panel)); MoveMouse(position); diff --git a/chrome/browser/ui/panels/docked_panel_browsertest.cc b/chrome/browser/ui/panels/docked_panel_browsertest.cc index c56e17d..f46c284 100644 --- a/chrome/browser/ui/panels/docked_panel_browsertest.cc +++ b/chrome/browser/ui/panels/docked_panel_browsertest.cc @@ -9,8 +9,8 @@ #include "chrome/browser/ui/panels/panel_manager.h" #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h" #include "chrome/common/chrome_notification_types.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/notification_service.h" +#include "content/public/test/test_utils.h" // Refactor has only been done for Win and Mac panels so far. #if defined(OS_WIN) || defined(OS_MACOSX) @@ -183,7 +183,7 @@ IN_PROC_BROWSER_TEST_F(DockedPanelBrowserTest, MinimizeSqueezedActive) { EXPECT_EQ(width_of_panel3_squeezed, panel3->GetBounds().width()); // Minimize the active panel. It should become inactive and shrink in width. - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_PANEL_STRIP_UPDATED, content::NotificationService::AllSources()); panel7->Minimize(); diff --git a/chrome/browser/ui/panels/old_base_panel_browser_test.cc b/chrome/browser/ui/panels/old_base_panel_browser_test.cc index 938b130..ab0df4d 100644 --- a/chrome/browser/ui/panels/old_base_panel_browser_test.cc +++ b/chrome/browser/ui/panels/old_base_panel_browser_test.cc @@ -255,7 +255,7 @@ void OldBasePanelBrowserTest::WaitForPanelActiveState( void OldBasePanelBrowserTest::WaitForWindowSizeAvailable(Panel* panel) { scoped_ptr<NativePanelTesting> panel_testing( CreateNativePanelTesting(panel)); - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_PANEL_WINDOW_SIZE_KNOWN, content::Source<Panel>(panel)); if (panel_testing->IsWindowSizeKnown()) @@ -267,7 +267,7 @@ void OldBasePanelBrowserTest::WaitForWindowSizeAvailable(Panel* panel) { void OldBasePanelBrowserTest::WaitForBoundsAnimationFinished(Panel* panel) { scoped_ptr<NativePanelTesting> panel_testing( CreateNativePanelTesting(panel)); - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, content::Source<Panel>(panel)); if (!panel_testing->IsAnimatingBounds()) @@ -278,7 +278,7 @@ void OldBasePanelBrowserTest::WaitForBoundsAnimationFinished(Panel* panel) { void OldBasePanelBrowserTest::WaitForExpansionStateChanged( Panel* panel, Panel::ExpansionState expansion_state) { - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE, content::Source<Panel>(panel)); if (panel->expansion_state() == expansion_state) @@ -306,7 +306,7 @@ Panel* OldBasePanelBrowserTest::CreatePanelWithParams( EXPECT_TRUE(panel_browser->is_type_panel()); if (!params.url.is_empty()) { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::AddSelectedTabWithURL(panel_browser, params.url, @@ -447,7 +447,7 @@ void OldBasePanelBrowserTest::CloseWindowAndWait(Panel* panel) { // message pump and wait for the notification. PanelManager* manager = PanelManager::GetInstance(); int panel_count = manager->num_panels(); - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_PANEL_CLOSED, content::Source<Panel>(panel)); panel->Close(); @@ -470,7 +470,7 @@ void OldBasePanelBrowserTest::CloseWindowAndWait(Panel* panel) { void OldBasePanelBrowserTest::MoveMouseAndWaitForExpansionStateChange( Panel* panel, const gfx::Point& position) { - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE, content::Source<Panel>(panel)); MoveMouse(position); diff --git a/chrome/browser/ui/panels/old_docked_panel_browsertest.cc b/chrome/browser/ui/panels/old_docked_panel_browsertest.cc index d7bea4a..95af1d6 100644 --- a/chrome/browser/ui/panels/old_docked_panel_browsertest.cc +++ b/chrome/browser/ui/panels/old_docked_panel_browsertest.cc @@ -9,8 +9,8 @@ #include "chrome/browser/ui/panels/panel_manager.h" #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h" #include "chrome/common/chrome_notification_types.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/notification_service.h" +#include "content/public/test/test_utils.h" class OldDockedPanelBrowserTest : public OldBasePanelBrowserTest { public: @@ -193,7 +193,7 @@ IN_PROC_BROWSER_TEST_F(OldDockedPanelBrowserTest, MAYBE_MinimizeSqueezedActive) EXPECT_EQ(width_of_panel3_squeezed, panel3->GetBounds().width()); // Minimize the active panel. It should become inactive and shrink in width. - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_PANEL_STRIP_UPDATED, content::NotificationService::AllSources()); panel7->Minimize(); diff --git a/chrome/browser/ui/panels/old_panel_browsertest.cc b/chrome/browser/ui/panels/old_panel_browsertest.cc index 79873ae..55b6259 100644 --- a/chrome/browser/ui/panels/old_panel_browsertest.cc +++ b/chrome/browser/ui/panels/old_panel_browsertest.cc @@ -367,7 +367,7 @@ IN_PROC_BROWSER_TEST_F(OldPanelBrowserTest, DISABLED_AutoResize) { // Expand the test page. gfx::Rect initial_bounds = panel->GetBounds(); - ui_test_utils::WindowedNotificationObserver enlarge( + content::WindowedNotificationObserver enlarge( chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, content::Source<Panel>(panel)); EXPECT_TRUE(ui_test_utils::ExecuteJavaScript( @@ -380,7 +380,7 @@ IN_PROC_BROWSER_TEST_F(OldPanelBrowserTest, DISABLED_AutoResize) { EXPECT_EQ(bounds_on_grow.height(), initial_bounds.height()); // Shrink the test page. - ui_test_utils::WindowedNotificationObserver shrink( + content::WindowedNotificationObserver shrink( chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, content::Source<Panel>(panel)); EXPECT_TRUE(ui_test_utils::ExecuteJavaScript( @@ -406,7 +406,7 @@ IN_PROC_BROWSER_TEST_F(OldPanelBrowserTest, DISABLED_AutoResize) { EXPECT_EQ(new_bounds.size(), panel->GetRestoredBounds().size()); // Turn back on auto-resize and verify that it works. - ui_test_utils::WindowedNotificationObserver auto_resize_enabled( + content::WindowedNotificationObserver auto_resize_enabled( chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, content::Source<Panel>(panel)); panel->SetAutoResizable(true); @@ -1260,7 +1260,7 @@ IN_PROC_BROWSER_TEST_F(OldPanelBrowserTest, Panel* panel2 = CreatePanelWithParams(params); // Close main tabbed window. - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_BROWSER_CLOSED, content::Source<Browser>(browser())); chrome::CloseWindow(browser()); @@ -1337,10 +1337,10 @@ IN_PROC_BROWSER_TEST_F(OldPanelBrowserTest, web_app::GenerateApplicationNameFromExtensionId(extension_other->id()); Panel* panel_other = CreatePanel(extension_app_name_other); - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_PANEL_CLOSED, content::Source<Panel>(panel)); - ui_test_utils::WindowedNotificationObserver signal1( + content::WindowedNotificationObserver signal1( chrome::NOTIFICATION_PANEL_CLOSED, content::Source<Panel>(panel1)); @@ -1400,7 +1400,7 @@ IN_PROC_BROWSER_TEST_F(OldPanelBrowserTest, OnBeforeUnloadOnClose) { // Close panel and respond to the onbeforeunload dialog with accept. This is // equivalent to clicking "Leave this page". - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_PANEL_CLOSED, content::Source<Panel>(panel)); panel->Close(); @@ -1453,7 +1453,7 @@ IN_PROC_BROWSER_TEST_F(OldPanelBrowserTest, TightAutosizeAroundSingleLine) { int initial_height = panel->GetBounds().height(); // Inject some HTML content into the panel. - ui_test_utils::WindowedNotificationObserver enlarge( + content::WindowedNotificationObserver enlarge( chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, content::Source<Panel>(panel)); EXPECT_TRUE(ui_test_utils::ExecuteJavaScript( diff --git a/chrome/browser/ui/panels/panel_browser_window_cocoa_unittest.mm b/chrome/browser/ui/panels/panel_browser_window_cocoa_unittest.mm index 651253e..2eaee38 100644 --- a/chrome/browser/ui/panels/panel_browser_window_cocoa_unittest.mm +++ b/chrome/browser/ui/panels/panel_browser_window_cocoa_unittest.mm @@ -25,15 +25,15 @@ #import "chrome/browser/ui/panels/panel_window_controller_cocoa.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" -#include "chrome/test/base/ui_test_utils.h" +#include "content/public/test/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" class PanelAnimatedBoundsObserver : - public ui_test_utils::WindowedNotificationObserver { + public content::WindowedNotificationObserver { public: PanelAnimatedBoundsObserver(Panel* panel) - : ui_test_utils::WindowedNotificationObserver( + : content::WindowedNotificationObserver( chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, content::Source<Panel>(panel)) { } virtual ~PanelAnimatedBoundsObserver() { } @@ -103,7 +103,7 @@ class PanelBrowserWindowCocoaTest : public CocoaProfileTest { // message pump and wait for the notification. PanelManager* manager = PanelManager::GetInstance(); int panel_count = manager->num_panels(); - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_PANEL_CLOSED, content::Source<Panel>(panel)); panel->Close(); @@ -300,7 +300,7 @@ TEST_F(PanelBrowserWindowCocoaTest, TitlebarViewClose) { PanelManager* manager = PanelManager::GetInstance(); EXPECT_EQ(1, manager->num_panels()); // Simulate clicking Close Button and wait until the Panel closes. - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_PANEL_CLOSED, content::Source<Panel>(panel)); [titlebar simulateCloseButtonClick]; diff --git a/chrome/browser/ui/panels/panel_browsertest.cc b/chrome/browser/ui/panels/panel_browsertest.cc index f110c49..9c4677c 100644 --- a/chrome/browser/ui/panels/panel_browsertest.cc +++ b/chrome/browser/ui/panels/panel_browsertest.cc @@ -374,7 +374,7 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, AutoResize) { // Expand the test page. The resize will update the docked panel strip. gfx::Rect initial_bounds = panel->GetBounds(); - ui_test_utils::WindowedNotificationObserver enlarge( + content::WindowedNotificationObserver enlarge( chrome::NOTIFICATION_PANEL_STRIP_UPDATED, content::NotificationService::AllSources()); EXPECT_TRUE(ui_test_utils::ExecuteJavaScript( @@ -387,7 +387,7 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, AutoResize) { EXPECT_EQ(bounds_on_grow.height(), initial_bounds.height()); // Shrink the test page. The resize will update the docked panel strip. - ui_test_utils::WindowedNotificationObserver shrink( + content::WindowedNotificationObserver shrink( chrome::NOTIFICATION_PANEL_STRIP_UPDATED, content::NotificationService::AllSources()); EXPECT_TRUE(ui_test_utils::ExecuteJavaScript( @@ -413,7 +413,7 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, AutoResize) { EXPECT_EQ(new_bounds.size(), panel->GetRestoredBounds().size()); // Turn back on auto-resize and verify that panel auto resizes. - ui_test_utils::WindowedNotificationObserver auto_resize_enabled( + content::WindowedNotificationObserver auto_resize_enabled( chrome::NOTIFICATION_PANEL_STRIP_UPDATED, content::NotificationService::AllSources()); panel->SetAutoResizable(true); @@ -1338,7 +1338,7 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, Panel* panel2 = CreatePanelWithParams(params); // Close main tabbed window. - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_BROWSER_CLOSED, content::Source<Browser>(browser())); chrome::CloseWindow(browser()); @@ -1408,10 +1408,10 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, web_app::GenerateApplicationNameFromExtensionId(extension_other->id()); Panel* panel_other = CreatePanel(extension_app_name_other); - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_PANEL_CLOSED, content::Source<Panel>(panel)); - ui_test_utils::WindowedNotificationObserver signal1( + content::WindowedNotificationObserver signal1( chrome::NOTIFICATION_PANEL_CLOSED, content::Source<Panel>(panel1)); @@ -1497,7 +1497,7 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, int initial_height = panel->GetBounds().height(); // Inject some HTML content into the panel. - ui_test_utils::WindowedNotificationObserver enlarge( + content::WindowedNotificationObserver enlarge( chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, content::Source<Panel>(panel)); EXPECT_TRUE(ui_test_utils::ExecuteJavaScript( diff --git a/chrome/browser/ui/panels/panel_cocoa_unittest.mm b/chrome/browser/ui/panels/panel_cocoa_unittest.mm index d2f262e..89b4f5f 100644 --- a/chrome/browser/ui/panels/panel_cocoa_unittest.mm +++ b/chrome/browser/ui/panels/panel_cocoa_unittest.mm @@ -21,15 +21,15 @@ #import "chrome/browser/ui/panels/panel_window_controller_cocoa.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" -#include "chrome/test/base/ui_test_utils.h" +#include "content/public/test/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" class PanelAnimatedBoundsObserver : - public ui_test_utils::WindowedNotificationObserver { + public content::WindowedNotificationObserver { public: PanelAnimatedBoundsObserver(Panel* panel) - : ui_test_utils::WindowedNotificationObserver( + : content::WindowedNotificationObserver( chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, content::Source<Panel>(panel)) { } virtual ~PanelAnimatedBoundsObserver() { } @@ -94,7 +94,7 @@ class PanelCocoaTest : public CocoaProfileTest { // message pump and wait for the notification. PanelManager* manager = PanelManager::GetInstance(); int panel_count = manager->num_panels(); - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_PANEL_CLOSED, content::Source<Panel>(panel)); panel->Close(); @@ -283,7 +283,7 @@ TEST_F(PanelCocoaTest, TitlebarViewClose) { PanelManager* manager = PanelManager::GetInstance(); EXPECT_EQ(1, manager->num_panels()); // Simulate clicking Close Button and wait until the Panel closes. - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_PANEL_CLOSED, content::Source<Panel>(panel)); [titlebar simulateCloseButtonClick]; diff --git a/chrome/browser/ui/panels/test_panel_active_state_observer.cc b/chrome/browser/ui/panels/test_panel_active_state_observer.cc index 3e53995..b96e547 100644 --- a/chrome/browser/ui/panels/test_panel_active_state_observer.cc +++ b/chrome/browser/ui/panels/test_panel_active_state_observer.cc @@ -6,6 +6,9 @@ #include "chrome/browser/ui/panels/panel.h" #include "chrome/common/chrome_notification_types.h" +#include "content/public/browser/notification_source.h" +#include "content/public/test/test_utils.h" +#include "testing/gtest/include/gtest/gtest.h" PanelActiveStateObserver::PanelActiveStateObserver( Panel* panel, @@ -25,7 +28,7 @@ void PanelActiveStateObserver::Wait() { return; running_ = true; - message_loop_runner_ = new ui_test_utils::MessageLoopRunner; + message_loop_runner_ = new content::MessageLoopRunner; message_loop_runner_->Run(); EXPECT_TRUE(seen_); } diff --git a/chrome/browser/ui/panels/test_panel_active_state_observer.h b/chrome/browser/ui/panels/test_panel_active_state_observer.h index b1e8744..066d87f 100644 --- a/chrome/browser/ui/panels/test_panel_active_state_observer.h +++ b/chrome/browser/ui/panels/test_panel_active_state_observer.h @@ -5,10 +5,16 @@ #ifndef CHROME_BROWSER_UI_PANELS_TEST_PANEL_ACTIVE_STATE_OBSERVER_H_ #define CHROME_BROWSER_UI_PANELS_TEST_PANEL_ACTIVE_STATE_OBSERVER_H_ -#include "chrome/test/base/ui_test_utils.h" +#include "base/memory/ref_counted.h" +#include "content/public/browser/notification_observer.h" +#include "content/public/browser/notification_registrar.h" class Panel; +namespace content { +class MessageLoopRunner; +} + // Custom notification observer for waiting on panel active state. // Modeled after ui_test_utils notification observers. class PanelActiveStateObserver : public content::NotificationObserver { @@ -34,7 +40,7 @@ class PanelActiveStateObserver : public content::NotificationObserver { bool seen_; // true after transition to expected state has been seen bool running_; // indicates whether message loop is running content::NotificationRegistrar registrar_; - scoped_refptr<ui_test_utils::MessageLoopRunner> message_loop_runner_; + scoped_refptr<content::MessageLoopRunner> message_loop_runner_; DISALLOW_COPY_AND_ASSIGN(PanelActiveStateObserver); }; diff --git a/chrome/browser/ui/pdf/pdf_browsertest.cc b/chrome/browser/ui/pdf/pdf_browsertest.cc index c4e0ec6..1417cdb 100644 --- a/chrome/browser/ui/pdf/pdf_browsertest.cc +++ b/chrome/browser/ui/pdf/pdf_browsertest.cc @@ -345,7 +345,7 @@ IN_PROC_BROWSER_TEST_F(PDFBrowserTest, DISABLED_OnLoadAndReload) { GURL url = pdf_test_server()->GetURL("files/onload_reload.html"); ui_test_utils::NavigateToURL(browser(), url); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); diff --git a/chrome/browser/ui/views/ash/launcher/chrome_launcher_controller_browsertest.cc b/chrome/browser/ui/views/ash/launcher/chrome_launcher_controller_browsertest.cc index 31afd6c..e69b9ea 100644 --- a/chrome/browser/ui/views/ash/launcher/chrome_launcher_controller_browsertest.cc +++ b/chrome/browser/ui/views/ash/launcher/chrome_launcher_controller_browsertest.cc @@ -434,7 +434,7 @@ IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTest, LaunchPinned) { EXPECT_EQ(++tab_count, tab_strip->count()); EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); TabContents* tab = tab_strip->GetActiveTabContents(); - ui_test_utils::WindowedNotificationObserver close_observer( + content::WindowedNotificationObserver close_observer( chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED, content::Source<TabContents>(tab)); browser()->tab_strip_model()->CloseSelectedTabs(); @@ -453,7 +453,7 @@ IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTest, LaunchUnpinned) { ash::LauncherID shortcut_id = CreateShortcut("app1"); EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); TabContents* tab = tab_strip->GetActiveTabContents(); - ui_test_utils::WindowedNotificationObserver close_observer( + content::WindowedNotificationObserver close_observer( chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED, content::Source<TabContents>(tab)); browser()->tab_strip_model()->CloseSelectedTabs(); @@ -478,7 +478,7 @@ IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTest, LaunchInBackground) { IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTest, LaunchMaximized) { aura::Window* window1 = browser()->window()->GetNativeWindow(); ash::wm::MaximizeWindow(window1); - ui_test_utils::WindowedNotificationObserver open_observer( + content::WindowedNotificationObserver open_observer( chrome::NOTIFICATION_BROWSER_WINDOW_READY, content::NotificationService::AllSources()); chrome::NewEmptyWindow(browser()->profile()); diff --git a/chrome/browser/ui/views/browser_actions_container_browsertest.cc b/chrome/browser/ui/views/browser_actions_container_browsertest.cc index 03ac06c..8888178 100644 --- a/chrome/browser/ui/views/browser_actions_container_browsertest.cc +++ b/chrome/browser/ui/views/browser_actions_container_browsertest.cc @@ -11,7 +11,7 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension_action.h" #include "chrome/common/extensions/extension_resource.h" -#include "chrome/test/base/ui_test_utils.h" +#include "content/public/test/test_utils.h" using extensions::Extension; @@ -37,7 +37,7 @@ class BrowserActionsContainerTest : public ExtensionBrowserTest { ExtensionAction* browser_action = browser_actions_bar_->GetExtensionAction(extension_index); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, content::Source<ExtensionAction>(browser_action)); observer.Wait(); diff --git a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc index 2f14ccd..37692da 100644 --- a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc +++ b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc @@ -186,7 +186,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_FocusRestoreOnTabSwitch) { EXPECT_TRUE(ASCIIToUTF16("a") == find_bar->GetFindSelectedText()); // Open another tab (tab B). - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); chrome::AddSelectedTabWithURL(browser(), url, content::PAGE_TRANSITION_TYPED); diff --git a/chrome/browser/ui/views/frame/app_non_client_frame_view_aura_browsertest.cc b/chrome/browser/ui/views/frame/app_non_client_frame_view_aura_browsertest.cc index 1bfd51e..5753704 100644 --- a/chrome/browser/ui/views/frame/app_non_client_frame_view_aura_browsertest.cc +++ b/chrome/browser/ui/views/frame/app_non_client_frame_view_aura_browsertest.cc @@ -11,7 +11,7 @@ #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/test/base/in_process_browser_test.h" -#include "chrome/test/base/ui_test_utils.h" +#include "content/public/test/test_utils.h" #include "ui/aura/root_window.h" #include "ui/aura/test/event_generator.h" #include "ui/aura/window.h" @@ -90,7 +90,7 @@ IN_PROC_BROWSER_TEST_F(AppNonClientFrameViewAuraTest, ClickClose) { // Click close button. eg.MoveMouseTo(root_window->bounds().width() - 1, 0); - ui_test_utils::WindowedNotificationObserver signal( + content::WindowedNotificationObserver signal( chrome::NOTIFICATION_BROWSER_CLOSED, content::Source<Browser>(app_browser())); eg.ClickLeftButton(); diff --git a/chrome/browser/ui/views/keyboard_access_browsertest.cc b/chrome/browser/ui/views/keyboard_access_browsertest.cc index 5d480e5..976f832 100644 --- a/chrome/browser/ui/views/keyboard_access_browsertest.cc +++ b/chrome/browser/ui/views/keyboard_access_browsertest.cc @@ -148,7 +148,7 @@ void KeyboardAccessTest::TestMenuKeyboardAccess(bool alternate_key_sequence, // page menu, then wait until the focused view changes. int original_view_id = GetFocusedViewID(); - ui_test_utils::WindowedNotificationObserver new_tab_observer( + content::WindowedNotificationObserver new_tab_observer( chrome::NOTIFICATION_TAB_ADDED, content::Source<content::WebContentsDelegate>(browser())); diff --git a/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc b/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc index 69e2751..a1dca47 100644 --- a/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc +++ b/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc @@ -20,10 +20,10 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/select_file_dialog.h" #include "chrome/common/chrome_paths.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" #include "content/public/browser/render_view_host.h" +#include "content/public/test/test_utils.h" #include "ui/base/dialogs/selected_file_info.h" #include "webkit/fileapi/file_system_context.h" #include "webkit/fileapi/file_system_mount_point_provider.h" @@ -173,7 +173,7 @@ class SelectFileDialogExtensionBrowserTest : public ExtensionBrowserTest { const gfx::NativeWindow& owning_window) { // Inject JavaScript to click the cancel button and wait for notification // that the window has closed. - ui_test_utils::WindowedNotificationObserver host_destroyed( + content::WindowedNotificationObserver host_destroyed( content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, content::NotificationService::AllSources()); content::RenderViewHost* host = dialog_->GetRenderViewHost(); diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc b/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc index 788c237..7900b91 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc +++ b/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc @@ -59,7 +59,7 @@ IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, LoadNTPInExistingProcess) { { // Wait not just for the navigation to finish, but for the NTP process to // exit as well. - ui_test_utils::WindowedNotificationObserver process_exited_observer( + content::WindowedNotificationObserver process_exited_observer( content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, content::NotificationService::AllSources()); browser()->OpenURL(OpenURLParams( diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui_browsertest.cc b/chrome/browser/ui/webui/print_preview/print_preview_ui_browsertest.cc index 9e91435..8436e2f 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_ui_browsertest.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_ui_browsertest.cc @@ -9,10 +9,10 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/in_process_browser_test.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" #include "content/public/test/test_navigation_observer.h" +#include "content/public/test/test_utils.h" namespace { @@ -27,7 +27,7 @@ class PrintPreviewTest : public InProcessBrowserTest { #endif void Print() { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, content::NotificationService::AllSources()); chrome::ExecuteCommand(browser(), IDC_PRINT); diff --git a/chrome/browser/unload_browsertest.cc b/chrome/browser/unload_browsertest.cc index 1b7e67d..46b9658 100644 --- a/chrome/browser/unload_browsertest.cc +++ b/chrome/browser/unload_browsertest.cc @@ -162,7 +162,7 @@ class UnloadTest : public InProcessBrowserTest { void LoadUrlAndQuitBrowser(const std::string& html_content, const char* expected_title) { NavigateToDataURL(html_content, expected_title); - ui_test_utils::WindowedNotificationObserver window_observer( + content::WindowedNotificationObserver window_observer( chrome::NOTIFICATION_BROWSER_CLOSED, content::NotificationService::AllSources()); chrome::CloseWindow(browser()); @@ -255,7 +255,7 @@ IN_PROC_BROWSER_TEST_F(UnloadTest, DISABLED_BrowserCloseUnload) { IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserCloseBeforeUnloadOK) { NavigateToDataURL(BEFORE_UNLOAD_HTML, "beforeunload"); - ui_test_utils::WindowedNotificationObserver window_observer( + content::WindowedNotificationObserver window_observer( chrome::NOTIFICATION_BROWSER_CLOSED, content::NotificationService::AllSources()); chrome::CloseWindow(browser()); @@ -280,7 +280,7 @@ IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserCloseBeforeUnloadCancel) { ClickModalDialogButton(false); ASSERT_EQ(expected_title, title_watcher.WaitAndGetTitle()); - ui_test_utils::WindowedNotificationObserver window_observer( + content::WindowedNotificationObserver window_observer( chrome::NOTIFICATION_BROWSER_CLOSED, content::NotificationService::AllSources()); chrome::CloseWindow(browser()); @@ -303,7 +303,7 @@ IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserTerminateBeforeUnload) { IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserCloseWithInnerFocusedFrame) { NavigateToDataURL(INNER_FRAME_WITH_FOCUS_HTML, "innerframewithfocus"); - ui_test_utils::WindowedNotificationObserver window_observer( + content::WindowedNotificationObserver window_observer( chrome::NOTIFICATION_BROWSER_CLOSED, content::NotificationService::AllSources()); chrome::CloseWindow(browser()); @@ -385,10 +385,10 @@ IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserCloseTabWhenOtherTabHasListener) { // Simulate a click to force user_gesture to true; if we don't, the resulting // popup will be constrained, which isn't what we want to test. - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_TAB_ADDED, content::NotificationService::AllSources()); - ui_test_utils::WindowedNotificationObserver load_stop_observer( + content::WindowedNotificationObserver load_stop_observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); ui_test_utils::SimulateMouseClick(chrome::GetActiveWebContents(browser())); @@ -396,7 +396,7 @@ IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserCloseTabWhenOtherTabHasListener) { load_stop_observer.Wait(); CheckTitle("popup"); - ui_test_utils::WindowedNotificationObserver tab_close_observer( + content::WindowedNotificationObserver tab_close_observer( content::NOTIFICATION_WEB_CONTENTS_DESTROYED, content::NotificationService::AllSources()); chrome::CloseTab(browser()); diff --git a/chrome/test/base/in_process_browser_test.cc b/chrome/test/base/in_process_browser_test.cc index 4203750..5f4d40c 100644 --- a/chrome/test/base/in_process_browser_test.cc +++ b/chrome/test/base/in_process_browser_test.cc @@ -274,9 +274,9 @@ Browser* InProcessBrowserTest::CreateBrowserForApp( } void InProcessBrowserTest::AddBlankTabAndShow(Browser* browser) { - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, - content::NotificationService::AllSources()); + content::NotificationService::AllSources()); chrome::AddSelectedTabWithURL(browser, GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_START_PAGE); observer.Wait(); diff --git a/chrome/test/base/test_web_dialog_observer.cc b/chrome/test/base/test_web_dialog_observer.cc index 75b7a34..9b3bb8b 100644 --- a/chrome/test/base/test_web_dialog_observer.cc +++ b/chrome/test/base/test_web_dialog_observer.cc @@ -13,6 +13,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" #include "content/public/test/js_injection_ready_observer.h" +#include "content/public/test/test_utils.h" using content::NavigationController; @@ -73,7 +74,7 @@ content::WebUI* TestWebDialogObserver::GetWebUI() { if (!done_) { EXPECT_FALSE(running_); running_ = true; - message_loop_runner_ = new ui_test_utils::MessageLoopRunner; + message_loop_runner_ = new content::MessageLoopRunner; message_loop_runner_->Run(); } return web_ui_; diff --git a/chrome/test/base/test_web_dialog_observer.h b/chrome/test/base/test_web_dialog_observer.h index ba90bc8..bfe0323 100644 --- a/chrome/test/base/test_web_dialog_observer.h +++ b/chrome/test/base/test_web_dialog_observer.h @@ -7,7 +7,7 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" -#include "chrome/test/base/ui_test_utils.h" +#include "base/memory/ref_counted.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "ui/web_dialogs/web_dialog_observer.h" @@ -15,6 +15,7 @@ namespace content { class JsInjectionReadyObserver; +class MessageLoopRunner; class RenderViewHost; class WebUI; } @@ -55,7 +56,7 @@ class TestWebDialogObserver : public content::NotificationObserver, content::WebUI* web_ui_; bool done_; bool running_; - scoped_refptr<ui_test_utils::MessageLoopRunner> message_loop_runner_; + scoped_refptr<content::MessageLoopRunner> message_loop_runner_; DISALLOW_COPY_AND_ASSIGN(TestWebDialogObserver); }; diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc index 9299202..27a2dcc 100644 --- a/chrome/test/base/testing_profile.cc +++ b/chrome/test/base/testing_profile.cc @@ -53,8 +53,8 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/render_process_host.h" -#include "content/public/test/browser_test_utils.h" #include "content/public/test/mock_resource_context.h" +#include "content/public/test/test_utils.h" #include "net/cookies/cookie_monster.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_getter.h" @@ -396,7 +396,7 @@ void TestingProfile::BlockUntilBookmarkModelLoaded() { // TODO(phajdan.jr): Doesn't this hang if Top Sites are already loaded? void TestingProfile::BlockUntilTopSitesLoaded() { - ui_test_utils::WindowedNotificationObserver top_sites_loaded_observer( + content::WindowedNotificationObserver top_sites_loaded_observer( chrome::NOTIFICATION_TOP_SITES_LOADED, content::NotificationService::AllSources()); if (!GetHistoryService(Profile::EXPLICIT_ACCESS)) diff --git a/chrome/test/base/tracing.cc b/chrome/test/base/tracing.cc index 3c29bba..7e609ec 100644 --- a/chrome/test/base/tracing.cc +++ b/chrome/test/base/tracing.cc @@ -7,9 +7,9 @@ #include "base/debug/trace_event.h" #include "base/memory/singleton.h" #include "base/message_loop.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/trace_controller.h" #include "content/public/browser/trace_subscriber.h" +#include "content/public/test/test_utils.h" namespace { @@ -38,7 +38,7 @@ class InProcessTraceController : public content::TraceSubscriber { return false; // Wait for OnEndTracingComplete() to quit the message loop. // OnTraceDataCollected may be called multiple times while blocking here. - message_loop_runner_ = new ui_test_utils::MessageLoopRunner; + message_loop_runner_ = new content::MessageLoopRunner; message_loop_runner_->Run(); trace_buffer_.Finish(); trace_buffer_.SetOutputCallback(TraceResultBuffer::OutputCallback()); @@ -64,7 +64,7 @@ class InProcessTraceController : public content::TraceSubscriber { // For collecting trace data asynchronously. base::debug::TraceResultBuffer trace_buffer_; - scoped_refptr<ui_test_utils::MessageLoopRunner> message_loop_runner_; + scoped_refptr<content::MessageLoopRunner> message_loop_runner_; DISALLOW_COPY_AND_ASSIGN(InProcessTraceController); }; diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc index 089e6ac..cbde78e 100644 --- a/chrome/test/base/ui_test_utils.cc +++ b/chrome/test/base/ui_test_utils.cc @@ -65,6 +65,7 @@ #include "content/public/common/geoposition.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_navigation_observer.h" +#include "content/public/test/test_utils.h" #include "googleurl/src/gurl.h" #include "net/base/net_util.h" #include "net/test/python_utils.h" @@ -104,7 +105,7 @@ class DOMOperationObserver : public content::NotificationObserver, did_respond_(false) { registrar_.Add(this, content::NOTIFICATION_DOM_OPERATION_RESPONSE, content::Source<RenderViewHost>(render_view_host)); - message_loop_runner_ = new MessageLoopRunner; + message_loop_runner_ = new content::MessageLoopRunner; } virtual void Observe(int type, @@ -132,7 +133,7 @@ class DOMOperationObserver : public content::NotificationObserver, content::NotificationRegistrar registrar_; std::string response_; bool did_respond_; - scoped_refptr<MessageLoopRunner> message_loop_runner_; + scoped_refptr<content::MessageLoopRunner> message_loop_runner_; DISALLOW_COPY_AND_ASSIGN(DOMOperationObserver); }; @@ -147,7 +148,7 @@ class FindInPageNotificationObserver : public content::NotificationObserver { parent_tab->find_tab_helper()->current_find_request_id(); registrar_.Add(this, chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, content::Source<WebContents>(parent_tab_->web_contents())); - message_loop_runner_ = new MessageLoopRunner; + message_loop_runner_ = new content::MessageLoopRunner; message_loop_runner_->Run(); } @@ -186,7 +187,7 @@ class FindInPageNotificationObserver : public content::NotificationObserver { // The id of the current find request, obtained from WebContents. Allows us // to monitor when the search completes. int current_find_request_id_; - scoped_refptr<MessageLoopRunner> message_loop_runner_; + scoped_refptr<content::MessageLoopRunner> message_loop_runner_; DISALLOW_COPY_AND_ASSIGN(FindInPageNotificationObserver); }; @@ -327,14 +328,14 @@ void WaitForNavigations(NavigationController* controller, } void WaitForNewTab(Browser* browser) { - WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_TAB_ADDED, content::Source<content::WebContentsDelegate>(browser)); observer.Wait(); } void WaitForLoadStop(WebContents* tab) { - WindowedNotificationObserver load_stop_observer( + content::WindowedNotificationObserver load_stop_observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>(&tab->GetController())); // In many cases, the load may have finished before we get here. Only wait if @@ -406,11 +407,11 @@ static void NavigateToURLWithDispositionBlockUntilNavigationsComplete( initial_browsers.insert(*iter); } - WindowedNotificationObserver tab_added_observer( + content::WindowedNotificationObserver tab_added_observer( chrome::NOTIFICATION_TAB_ADDED, content::NotificationService::AllSources()); - WindowedNotificationObserver auth_observer( + content::WindowedNotificationObserver auth_observer( chrome::NOTIFICATION_AUTH_NEEDED, content::NotificationService::AllSources()); @@ -558,7 +559,7 @@ GURL GetFileUrlWithQuery(const FilePath& path, } AppModalDialog* WaitForAppModalDialog() { - WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN, content::NotificationService::AllSources()); observer.Wait(); @@ -572,7 +573,7 @@ void WaitForAppModalDialogAndCloseIt() { void CrashTab(WebContents* tab) { content::RenderProcessHost* rph = tab->GetRenderProcessHost(); - WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_RENDERER_PROCESS_CLOSED, content::Source<content::RenderProcessHost>(rph)); base::KillProcess(rph->GetHandle(), 0, false); @@ -712,7 +713,7 @@ void WaitForTemplateURLServiceToLoad(TemplateURLService* service) { } void WaitForHistoryToLoad(HistoryService* history_service) { - WindowedNotificationObserver history_loaded_observer( + content::WindowedNotificationObserver history_loaded_observer( chrome::NOTIFICATION_HISTORY_LOADED, content::NotificationService::AllSources()); if (!history_service->BackendLoaded()) @@ -756,7 +757,8 @@ bool SendKeyPressSync(const Browser* browser, gfx::NativeWindow window = NULL; if (!GetNativeWindow(browser, &window)) return false; - scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner; + scoped_refptr<content::MessageLoopRunner> runner = + new content::MessageLoopRunner; bool result; result = ui_controls::SendKeyPressNotifyWhenDone( window, key, control, shift, alt, command, runner->QuitClosure()); @@ -786,7 +788,7 @@ bool SendKeyPressAndWait(const Browser* browser, bool command, int type, const content::NotificationSource& source) { - WindowedNotificationObserver observer(type, source); + content::WindowedNotificationObserver observer(type, source); if (!SendKeyPressSync(browser, key, control, shift, alt, command)) return false; @@ -796,7 +798,8 @@ bool SendKeyPressAndWait(const Browser* browser, } bool SendMouseMoveSync(const gfx::Point& location) { - scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner; + scoped_refptr<content::MessageLoopRunner> runner = + new content::MessageLoopRunner; if (!ui_controls::SendMouseMoveNotifyWhenDone( location.x(), location.y(), runner->QuitClosure())) { return false; @@ -806,7 +809,8 @@ bool SendMouseMoveSync(const gfx::Point& location) { } bool SendMouseEventsSync(ui_controls::MouseButton type, int state) { - scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner; + scoped_refptr<content::MessageLoopRunner> runner = + new content::MessageLoopRunner; if (!ui_controls::SendMouseEventsNotifyWhenDone( type, state, runner->QuitClosure())) { return false; @@ -815,24 +819,6 @@ bool SendMouseEventsSync(ui_controls::MouseButton type, int state) { return !testing::Test::HasFatalFailure(); } -MessageLoopRunner::MessageLoopRunner() { -} - -MessageLoopRunner::~MessageLoopRunner() { -} - -void MessageLoopRunner::Run() { - content::RunThisRunLoop(&run_loop_); -} - -base::Closure MessageLoopRunner::QuitClosure() { - return base::Bind(&MessageLoopRunner::Quit, this); -} - -void MessageLoopRunner::Quit() { - content::GetQuitTaskForRunLoop(&run_loop_).Run(); -} - TestWebSocketServer::TestWebSocketServer() : started_(false), port_(kDefaultWsPort), @@ -979,41 +965,6 @@ TestWebSocketServer::~TestWebSocketServer() { #endif } -WindowedNotificationObserver::WindowedNotificationObserver( - int notification_type, - const content::NotificationSource& source) - : seen_(false), - running_(false), - source_(content::NotificationService::AllSources()) { - registrar_.Add(this, notification_type, source); -} - -WindowedNotificationObserver::~WindowedNotificationObserver() {} - -void WindowedNotificationObserver::Wait() { - if (seen_) - return; - - running_ = true; - message_loop_runner_ = new MessageLoopRunner; - message_loop_runner_->Run(); - EXPECT_TRUE(seen_); -} - -void WindowedNotificationObserver::Observe( - int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { - source_ = source; - details_ = details; - seen_ = true; - if (!running_) - return; - - message_loop_runner_->Quit(); - running_ = false; -} - WindowedTabAddedNotificationObserver::WindowedTabAddedNotificationObserver( const content::NotificationSource& source) : WindowedNotificationObserver(chrome::NOTIFICATION_TAB_ADDED, source), @@ -1024,8 +975,8 @@ void WindowedTabAddedNotificationObserver::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - added_tab_ = content::Details<content::WebContents>(details).ptr(); - WindowedNotificationObserver::Observe(type, source, details); + added_tab_ = content::Details<WebContents>(details).ptr(); + content::WindowedNotificationObserver::Observe(type, source, details); } TitleWatcher::TitleWatcher(WebContents* web_contents, @@ -1061,7 +1012,7 @@ const string16& TitleWatcher::WaitAndGetTitle() { if (expected_title_observed_) return observed_title_; quit_loop_on_observation_ = true; - message_loop_runner_ = new MessageLoopRunner; + message_loop_runner_ = new content::MessageLoopRunner; message_loop_runner_->Run(); return observed_title_; } @@ -1139,7 +1090,7 @@ bool DOMMessageQueue::WaitForMessage(std::string* message) { if (message_queue_.empty()) { waiting_for_message_ = true; // This will be quit when a new message comes in. - message_loop_runner_ = new MessageLoopRunner; + message_loop_runner_ = new content::MessageLoopRunner; message_loop_runner_->Run(); } // The queue should not be empty, unless we were quit because of a timeout. @@ -1168,7 +1119,7 @@ class SnapshotTaker { base::Bind(&SnapshotTaker::OnSnapshotTaken, base::Unretained(this)), page_size, desired_size); - message_loop_runner_ = new MessageLoopRunner; + message_loop_runner_ = new content::MessageLoopRunner; message_loop_runner_->Run(); return snapshot_taken_; } @@ -1211,7 +1162,7 @@ class SnapshotTaker { // Whether the snapshot was actually taken and received by this SnapshotTaker. // This will be false if the test times out. bool snapshot_taken_; - scoped_refptr<MessageLoopRunner> message_loop_runner_; + scoped_refptr<content::MessageLoopRunner> message_loop_runner_; DISALLOW_COPY_AND_ASSIGN(SnapshotTaker); }; @@ -1237,7 +1188,8 @@ void OverrideGeolocation(double latitude, double longitude) { position.altitude = 0.; position.accuracy = 0.; position.timestamp = base::Time::Now(); - scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner; + scoped_refptr<content::MessageLoopRunner> runner = + new content::MessageLoopRunner; content::OverrideLocationForTesting(position, runner->QuitClosure()); runner->Run(); } diff --git a/chrome/test/base/ui_test_utils.h b/chrome/test/base/ui_test_utils.h index 56339ec..7aa6469 100644 --- a/chrome/test/base/ui_test_utils.h +++ b/chrome/test/base/ui_test_utils.h @@ -13,7 +13,6 @@ #include "base/basictypes.h" #include "base/process.h" -#include "base/run_loop.h" #include "base/scoped_temp_dir.h" #include "base/string16.h" #include "chrome/browser/ui/view_ids.h" @@ -23,6 +22,7 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_source.h" +#include "content/public/test/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" #include "ui/base/keycodes/keyboard_codes.h" @@ -58,6 +58,7 @@ struct NavigateParams; } namespace content { +class MessageLoopRunner; class RenderViewHost; class RenderWidgetHost; class WebContents; @@ -298,36 +299,6 @@ bool SendMouseMoveSync(const gfx::Point& location) WARN_UNUSED_RESULT; bool SendMouseEventsSync(ui_controls::MouseButton type, int state) WARN_UNUSED_RESULT; -// Helper class to Run and Quit the message loop. Run and Quit can only happen -// once per instance. Make a new instance for each use. Calling Quit after Run -// has returned is safe and has no effect. -class MessageLoopRunner - : public base::RefCounted<MessageLoopRunner> { - public: - MessageLoopRunner(); - - // Run the current MessageLoop. - void Run(); - - // Quit the matching call to Run (nested MessageLoops are unaffected). - void Quit(); - - // Hand this closure off to code that uses callbacks to notify completion. - // Example: - // scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner; - // kick_off_some_api(runner.QuitNowClosure()); - // runner.Run(); - base::Closure QuitClosure(); - - private: - friend class base::RefCounted<MessageLoopRunner>; - ~MessageLoopRunner(); - - base::RunLoop run_loop_; - - DISALLOW_COPY_AND_ASSIGN(MessageLoopRunner); -}; - // This is a utility class for running a python websocket server // during tests. The server is started during the construction of the // object, and is stopped when the destructor is called. Note that @@ -392,63 +363,10 @@ class TestWebSocketServer { DISALLOW_COPY_AND_ASSIGN(TestWebSocketServer); }; -// A WindowedNotificationObserver allows code to watch for a notification -// over a window of time. Typically testing code will need to do something -// like this: -// PerformAction() -// WaitForCompletionNotification() -// This leads to flakiness as there's a window between PerformAction returning -// and the observers getting registered, where a notification will be missed. -// -// Rather, one can do this: -// WindowedNotificationObserver signal(...) -// PerformAction() -// signal.Wait() -class WindowedNotificationObserver : public content::NotificationObserver { - public: - // Register to listen for notifications of the given type from either a - // specific source, or from all sources if |source| is - // NotificationService::AllSources(). - WindowedNotificationObserver(int notification_type, - const content::NotificationSource& source); - virtual ~WindowedNotificationObserver(); - - // Wait until the specified notification occurs. If the notification was - // emitted between the construction of this object and this call then it - // returns immediately. - void Wait(); - - // Returns NotificationService::AllSources() if we haven't observed a - // notification yet. - const content::NotificationSource& source() const { - return source_; - } - - const content::NotificationDetails& details() const { - return details_; - } - - // content::NotificationObserver: - virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; - - private: - bool seen_; - bool running_; - content::NotificationRegistrar registrar_; - - content::NotificationSource source_; - content::NotificationDetails details_; - scoped_refptr<MessageLoopRunner> message_loop_runner_; - - DISALLOW_COPY_AND_ASSIGN(WindowedNotificationObserver); -}; - // A WindowedNotificationObserver hard-wired to observe // chrome::NOTIFICATION_TAB_ADDED. class WindowedTabAddedNotificationObserver - : public WindowedNotificationObserver { + : public content::WindowedNotificationObserver { public: // Register to listen for notifications of NOTIFICATION_TAB_ADDED from either // a specific source, or from all sources if |source| is @@ -475,12 +393,12 @@ class WindowedTabAddedNotificationObserver // which is the case with most notifications. template <class U> class WindowedNotificationObserverWithDetails - : public WindowedNotificationObserver { + : public content::WindowedNotificationObserver { public: WindowedNotificationObserverWithDetails( int notification_type, const content::NotificationSource& source) - : WindowedNotificationObserver(notification_type, source) {} + : content::WindowedNotificationObserver(notification_type, source) {} // Fills |details| with the details of the notification received for |source|. bool GetDetailsFor(uintptr_t source, U* details) { @@ -498,7 +416,7 @@ class WindowedNotificationObserverWithDetails const U* details_ptr = content::Details<U>(details).ptr(); if (details_ptr) details_[source.map_key()] = *details_ptr; - WindowedNotificationObserver::Observe(type, source, details); + content::WindowedNotificationObserver::Observe(type, source, details); } private: @@ -534,7 +452,7 @@ class TitleWatcher : public content::NotificationObserver { content::WebContents* web_contents_; std::vector<string16> expected_titles_; content::NotificationRegistrar notification_registrar_; - scoped_refptr<MessageLoopRunner> message_loop_runner_; + scoped_refptr<content::MessageLoopRunner> message_loop_runner_; // The most recently observed expected title, if any. string16 observed_title_; @@ -557,7 +475,7 @@ class BrowserAddedObserver { Browser* WaitForSingleNewBrowser(); private: - WindowedNotificationObserver notification_observer_; + content::WindowedNotificationObserver notification_observer_; std::set<Browser*> original_browsers_; DISALLOW_COPY_AND_ASSIGN(BrowserAddedObserver); @@ -634,7 +552,7 @@ class DOMMessageQueue : public content::NotificationObserver { content::NotificationRegistrar registrar_; std::queue<std::string> message_queue_; bool waiting_for_message_; - scoped_refptr<MessageLoopRunner> message_loop_runner_; + scoped_refptr<content::MessageLoopRunner> message_loop_runner_; DISALLOW_COPY_AND_ASSIGN(DOMMessageQueue); }; diff --git a/chrome/test/perf/rendering/throughput_tests.cc b/chrome/test/perf/rendering/throughput_tests.cc index 4720ee0..d745a4b 100644 --- a/chrome/test/perf/rendering/throughput_tests.cc +++ b/chrome/test/perf/rendering/throughput_tests.cc @@ -28,7 +28,7 @@ #include "chrome/test/perf/perf_test.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_switches.h" -#include "content/public/test/browser_test_utils.h" +#include "content/public/test/test_utils.h" #include "content/test/gpu/gpu_test_config.h" #include "googleurl/src/gurl.h" #include "net/base/mock_host_resolver.h" diff --git a/content/browser/accessibility/cross_platform_accessibility_browsertest.cc b/content/browser/accessibility/cross_platform_accessibility_browsertest.cc index d361509..621fcdf 100644 --- a/content/browser/accessibility/cross_platform_accessibility_browsertest.cc +++ b/content/browser/accessibility/cross_platform_accessibility_browsertest.cc @@ -9,12 +9,12 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/test/base/in_process_browser_test.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" #include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/web_contents.h" +#include "content/public/test/test_utils.h" #if defined(OS_WIN) #include <atlbase.h> @@ -38,7 +38,7 @@ class CrossPlatformAccessibilityBrowserTest : public InProcessBrowserTest { // notification that it's been received. const AccessibilityNodeData& GetAccessibilityNodeDataTree( AccessibilityMode accessibility_mode = AccessibilityModeComplete) { - ui_test_utils::WindowedNotificationObserver tree_updated_observer( + content::WindowedNotificationObserver tree_updated_observer( content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); content::RenderWidgetHostView* host_view = diff --git a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc index d995277..8ea1da9 100644 --- a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc +++ b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc @@ -13,7 +13,6 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/test/base/in_process_browser_test.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/browser/accessibility/browser_accessibility.h" #include "content/browser/accessibility/browser_accessibility_manager.h" #include "content/browser/accessibility/dump_accessibility_tree_helper.h" @@ -23,6 +22,7 @@ #include "content/public/browser/notification_types.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_paths.h" +#include "content/public/test/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" using content::OpenURLParams; @@ -138,7 +138,7 @@ IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, printf("Testing %s\n", html_file.BaseName().MaybeAsASCII().c_str()); // Load the page. - ui_test_utils::WindowedNotificationObserver tree_updated_observer( + content::WindowedNotificationObserver tree_updated_observer( content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); string16 html_contents16; diff --git a/content/browser/renderer_host/render_view_host_manager_browsertest.cc b/content/browser/renderer_host/render_view_host_manager_browsertest.cc index da9135ea..344b104 100644 --- a/content/browser/renderer_host/render_view_host_manager_browsertest.cc +++ b/content/browser/renderer_host/render_view_host_manager_browsertest.cc @@ -401,7 +401,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, // Clicking the original link in the first tab should cause us to swap back. chrome::ActivateTabAt(browser(), 0, true); - ui_test_utils::WindowedNotificationObserver navigation_observer( + content::WindowedNotificationObserver navigation_observer( content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<content::NavigationController>( &new_contents->GetController())); @@ -425,7 +425,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, EXPECT_EQ(new_site_instance, chrome::GetActiveWebContents(browser())->GetSiteInstance()); chrome::ActivateTabAt(browser(), 0, true); - ui_test_utils::WindowedNotificationObserver close_observer( + content::WindowedNotificationObserver close_observer( content::NOTIFICATION_WEB_CONTENTS_DESTROYED, content::Source<content::WebContents>(new_contents)); EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( @@ -539,7 +539,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, // 3) Post a message from the foo window to the opener. The opener will // reply, causing the foo window to update its own title. - ui_test_utils::WindowedNotificationObserver title_observer( + content::WindowedNotificationObserver title_observer( content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, content::Source<content::WebContents>(foo_contents)); EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( @@ -567,7 +567,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, // 4) Now post a message from the _blank window to the foo window. The // foo window will update its title and will not reply. - ui_test_utils::WindowedNotificationObserver title_observer2( + content::WindowedNotificationObserver title_observer2( content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, content::Source<content::WebContents>(foo_contents)); EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( @@ -646,7 +646,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, // The opened tab should be able to navigate the opener back to its process. chrome::ActivateTabAt(browser(), 1, true); - ui_test_utils::WindowedNotificationObserver navigation_observer( + content::WindowedNotificationObserver navigation_observer( content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<content::NavigationController>( &orig_contents->GetController())); @@ -735,7 +735,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, // Navigate the first tab to a different site as well. The original process // should exit, since all of its views are now swapped out. chrome::ActivateTabAt(browser(), 0, true); - ui_test_utils::WindowedNotificationObserver exit_observer( + content::WindowedNotificationObserver exit_observer( content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, content::Source<content::RenderProcessHost>(orig_process)); ui_test_utils::NavigateToURL(browser(), @@ -865,7 +865,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, BackForwardNotStale) { // Go back three times to first site. { - ui_test_utils::WindowedNotificationObserver back_nav_load_observer( + content::WindowedNotificationObserver back_nav_load_observer( content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<content::NavigationController>( &contents->GetController())); @@ -873,7 +873,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, BackForwardNotStale) { back_nav_load_observer.Wait(); } { - ui_test_utils::WindowedNotificationObserver back_nav_load_observer( + content::WindowedNotificationObserver back_nav_load_observer( content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<content::NavigationController>( &contents->GetController())); @@ -881,7 +881,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, BackForwardNotStale) { back_nav_load_observer.Wait(); } { - ui_test_utils::WindowedNotificationObserver back_nav_load_observer( + content::WindowedNotificationObserver back_nav_load_observer( content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<content::NavigationController>( &contents->GetController())); @@ -891,7 +891,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, BackForwardNotStale) { // Now go forward twice to B2. Shouldn't be left spinning. { - ui_test_utils::WindowedNotificationObserver forward_nav_load_observer( + content::WindowedNotificationObserver forward_nav_load_observer( content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<content::NavigationController>( &contents->GetController())); @@ -899,7 +899,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, BackForwardNotStale) { forward_nav_load_observer.Wait(); } { - ui_test_utils::WindowedNotificationObserver forward_nav_load_observer( + content::WindowedNotificationObserver forward_nav_load_observer( content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<content::NavigationController>( &contents->GetController())); @@ -909,7 +909,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, BackForwardNotStale) { // Go back twice to first site. { - ui_test_utils::WindowedNotificationObserver back_nav_load_observer( + content::WindowedNotificationObserver back_nav_load_observer( content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<content::NavigationController>( &contents->GetController())); @@ -917,7 +917,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, BackForwardNotStale) { back_nav_load_observer.Wait(); } { - ui_test_utils::WindowedNotificationObserver back_nav_load_observer( + content::WindowedNotificationObserver back_nav_load_observer( content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<content::NavigationController>( &contents->GetController())); @@ -927,7 +927,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, BackForwardNotStale) { // Now go forward directly to B3. Shouldn't be left spinning. { - ui_test_utils::WindowedNotificationObserver forward_nav_load_observer( + content::WindowedNotificationObserver forward_nav_load_observer( content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<content::NavigationController>( &contents->GetController())); @@ -1003,7 +1003,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, // Going back should make the previously swapped-out view to become visible // again. { - ui_test_utils::WindowedNotificationObserver back_nav_load_observer( + content::WindowedNotificationObserver back_nav_load_observer( content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<content::NavigationController>( &chrome::GetActiveWebContents(browser())->GetController())); diff --git a/content/browser/renderer_host/resource_dispatcher_host_browsertest.cc b/content/browser/renderer_host/resource_dispatcher_host_browsertest.cc index cbac546..6ee54c5 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_browsertest.cc +++ b/content/browser/renderer_host/resource_dispatcher_host_browsertest.cc @@ -335,9 +335,9 @@ IN_PROC_BROWSER_TEST_F(ResourceDispatcherHostBrowserTest, // strip the app on the build bots, this is bad times. IN_PROC_BROWSER_TEST_F(ResourceDispatcherHostBrowserTest, CrossSiteAfterCrash) { // Cause the renderer to crash. - ui_test_utils::WindowedNotificationObserver crash_observer( - content::NOTIFICATION_RENDERER_PROCESS_CLOSED, - content::NotificationService::AllSources()); + content::WindowedNotificationObserver crash_observer( + content::NOTIFICATION_RENDERER_PROCESS_CLOSED, + content::NotificationService::AllSources()); ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUICrashURL)); // Wait for browser to notice the renderer crash. crash_observer.Wait(); diff --git a/content/browser/session_history_browsertest.cc b/content/browser/session_history_browsertest.cc index f4e2f77..fe28fe4 100644 --- a/content/browser/session_history_browsertest.cc +++ b/content/browser/session_history_browsertest.cc @@ -75,17 +75,17 @@ class SessionHistoryTest : public InProcessBrowserTest { } void GoBack() { - ui_test_utils::WindowedNotificationObserver load_stop_observer( - content::NOTIFICATION_LOAD_STOP, - content::NotificationService::AllSources()); + content::WindowedNotificationObserver load_stop_observer( + content::NOTIFICATION_LOAD_STOP, + content::NotificationService::AllSources()); chrome::GoBack(browser(), CURRENT_TAB); load_stop_observer.Wait(); } void GoForward() { - ui_test_utils::WindowedNotificationObserver load_stop_observer( - content::NOTIFICATION_LOAD_STOP, - content::NotificationService::AllSources()); + content::WindowedNotificationObserver load_stop_observer( + content::NOTIFICATION_LOAD_STOP, + content::NotificationService::AllSources()); chrome::GoForward(browser(), CURRENT_TAB); load_stop_observer.Wait(); } diff --git a/content/browser/speech/speech_recognition_browsertest.cc b/content/browser/speech/speech_recognition_browsertest.cc index 339cfa7..9d62a17 100644 --- a/content/browser/speech/speech_recognition_browsertest.cc +++ b/content/browser/speech/speech_recognition_browsertest.cc @@ -209,7 +209,7 @@ class SpeechRecognitionBrowserTest : public InProcessBrowserTest { mouse_event.clickCount = 1; WebContents* web_contents = chrome::GetActiveWebContents(browser()); - ui_test_utils::WindowedNotificationObserver observer( + content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>(&web_contents->GetController())); web_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event); diff --git a/content/content_tests.gypi b/content/content_tests.gypi index a8bce63..2e63bd5 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -46,6 +46,7 @@ 'public/test/test_navigation_observer.h', 'public/test/test_notification_tracker.h', 'public/test/test_renderer_host.h', + 'public/test/test_utils.h', 'public/test/unittest_test_suite.h', 'public/test/web_contents_tester.h', 'app/startup_helper_win.cc', @@ -121,6 +122,7 @@ 'test/test_render_view_host_factory.cc', 'test/test_render_view_host_factory.h', 'test/test_launcher.cc', + 'test/test_utils.cc', 'test/test_web_contents_view.cc', 'test/test_web_contents_view.h', 'test/unittest_test_suite.cc', diff --git a/content/public/test/browser_test_utils.h b/content/public/test/browser_test_utils.h index 849842b..e295dd2 100644 --- a/content/public/test/browser_test_utils.h +++ b/content/public/test/browser_test_utils.h @@ -21,13 +21,6 @@ class RunLoop; namespace content { -// Variant of RunMessageLoop that takes RunLoop. -void RunThisRunLoop(base::RunLoop* run_loop); - -// Get task to quit the given RunLoop. It allows a few generations of pending -// tasks to run as opposed to run_loop->QuitClosure(). -base::Closure GetQuitTaskForRunLoop(base::RunLoop* run_loop); - } // namespace content #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ diff --git a/content/public/test/test_utils.h b/content/public/test/test_utils.h new file mode 100644 index 0000000..bf90806 --- /dev/null +++ b/content/public/test/test_utils.h @@ -0,0 +1,112 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_PUBLIC_TEST_TEST_UTILS_H_ +#define CONTENT_PUBLIC_TEST_TEST_UTILS_H_ + +#include "base/callback_forward.h" +#include "base/memory/ref_counted.h" +#include "base/run_loop.h" +#include "content/public/browser/notification_details.h" +#include "content/public/browser/notification_observer.h" +#include "content/public/browser/notification_registrar.h" +#include "content/public/browser/notification_source.h" +#include "googleurl/src/gurl.h" + +// A collections of functions designed for use with unit and browser tests. + +namespace content { + +// Variant of RunMessageLoop that takes RunLoop. +void RunThisRunLoop(base::RunLoop* run_loop); + +// Get task to quit the given RunLoop. It allows a few generations of pending +// tasks to run as opposed to run_loop->QuitClosure(). +base::Closure GetQuitTaskForRunLoop(base::RunLoop* run_loop); + +// Helper class to Run and Quit the message loop. Run and Quit can only happen +// once per instance. Make a new instance for each use. Calling Quit after Run +// has returned is safe and has no effect. +class MessageLoopRunner : public base::RefCounted<MessageLoopRunner> { + public: + MessageLoopRunner(); + + // Run the current MessageLoop. + void Run(); + + // Quit the matching call to Run (nested MessageLoops are unaffected). + void Quit(); + + // Hand this closure off to code that uses callbacks to notify completion. + // Example: + // scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner; + // kick_off_some_api(runner.QuitNowClosure()); + // runner.Run(); + base::Closure QuitClosure(); + + private: + friend class base::RefCounted<MessageLoopRunner>; + ~MessageLoopRunner(); + + base::RunLoop run_loop_; + + DISALLOW_COPY_AND_ASSIGN(MessageLoopRunner); +}; + +// A WindowedNotificationObserver allows code to watch for a notification +// over a window of time. Typically testing code will need to do something +// like this: +// PerformAction() +// WaitForCompletionNotification() +// This leads to flakiness as there's a window between PerformAction returning +// and the observers getting registered, where a notification will be missed. +// +// Rather, one can do this: +// WindowedNotificationObserver signal(...) +// PerformAction() +// signal.Wait() +class WindowedNotificationObserver : public NotificationObserver { + public: + // Register to listen for notifications of the given type from either a + // specific source, or from all sources if |source| is + // NotificationService::AllSources(). + WindowedNotificationObserver(int notification_type, + const NotificationSource& source); + virtual ~WindowedNotificationObserver(); + + // Wait until the specified notification occurs. If the notification was + // emitted between the construction of this object and this call then it + // returns immediately. + void Wait(); + + // Returns NotificationService::AllSources() if we haven't observed a + // notification yet. + const NotificationSource& source() const { + return source_; + } + + const NotificationDetails& details() const { + return details_; + } + + // NotificationObserver: + virtual void Observe(int type, + const NotificationSource& source, + const NotificationDetails& details) OVERRIDE; + + private: + bool seen_; + bool running_; + NotificationRegistrar registrar_; + + NotificationSource source_; + NotificationDetails details_; + scoped_refptr<MessageLoopRunner> message_loop_runner_; + + DISALLOW_COPY_AND_ASSIGN(WindowedNotificationObserver); +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_TEST_TEST_UTILS_H_ diff --git a/content/test/browser_test_utils.cc b/content/test/browser_test_utils.cc index c82e61a..145c432 100644 --- a/content/test/browser_test_utils.cc +++ b/content/test/browser_test_utils.cc @@ -4,56 +4,6 @@ #include "content/public/test/browser_test_utils.h" -#include "base/bind.h" -#include "base/message_loop.h" -#include "base/run_loop.h" -#include "content/public/test/test_launcher.h" - -namespace { - -// Number of times to repost a Quit task so that the MessageLoop finishes up -// pending tasks and tasks posted by those pending tasks without risking the -// potential hang behavior of MessageLoop::QuitWhenIdle. -// The criteria for choosing this number: it should be high enough to make the -// quit act like QuitWhenIdle, while taking into account that any page which is -// animating may be rendering another frame for each quit deferral. For an -// animating page, the potential delay to quitting the RunLoop would be -// kNumQuitDeferrals * frame_render_time. Some perf tests run slow, such as -// 200ms/frame. -static const int kNumQuitDeferrals = 10; - -static void DeferredQuitRunLoop(const base::Closure& quit_task, - int num_quit_deferrals) { - if (num_quit_deferrals <= 0) { - quit_task.Run(); - } else { - MessageLoop::current()->PostTask(FROM_HERE, - base::Bind(&DeferredQuitRunLoop, quit_task, num_quit_deferrals - 1)); - } -} - -} - namespace content { -void RunThisRunLoop(base::RunLoop* run_loop) { - MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); - - test_launcher::TestLauncherDelegate* delegate = - test_launcher::GetCurrentTestLauncherDelegate(); - // TODO(jam): the null check shouldn't be needed, since this code should only - // be called from browser_tests. Unfortunately some unittests are calling this - // code. - if (delegate) - delegate->PreRunMessageLoop(run_loop); - run_loop->Run(); - if (delegate) - delegate->PostRunMessageLoop(); -} - -base::Closure GetQuitTaskForRunLoop(base::RunLoop* run_loop) { - return base::Bind(&DeferredQuitRunLoop, run_loop->QuitClosure(), - kNumQuitDeferrals); -} - } // namespace content diff --git a/content/test/content_browser_test_utils.cc b/content/test/content_browser_test_utils.cc index 0794328..fc55372 100644 --- a/content/test/content_browser_test_utils.cc +++ b/content/test/content_browser_test_utils.cc @@ -12,8 +12,8 @@ #include "content/public/browser/notification_source.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_paths.h" -#include "content/public/test/browser_test_utils.h" #include "content/public/test/test_navigation_observer.h" +#include "content/public/test/test_utils.h" #include "content/shell/shell.h" #include "net/base/net_util.h" diff --git a/content/test/test_navigation_observer.cc b/content/test/test_navigation_observer.cc index 3cdd359..b3b3a17 100644 --- a/content/test/test_navigation_observer.cc +++ b/content/test/test_navigation_observer.cc @@ -10,8 +10,8 @@ #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" #include "content/public/browser/render_view_host_observer.h" -#include "content/public/test/browser_test_utils.h" #include "content/public/test/js_injection_ready_observer.h" +#include "content/public/test/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" namespace content { diff --git a/content/test/test_utils.cc b/content/test/test_utils.cc new file mode 100644 index 0000000..3477057 --- /dev/null +++ b/content/test/test_utils.cc @@ -0,0 +1,113 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/public/test/test_utils.h" + +#include "base/bind.h" +#include "base/message_loop.h" +#include "base/run_loop.h" +#include "content/public/browser/notification_service.h" +#include "content/public/test/test_launcher.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { + +// Number of times to repost a Quit task so that the MessageLoop finishes up +// pending tasks and tasks posted by those pending tasks without risking the +// potential hang behavior of MessageLoop::QuitWhenIdle. +// The criteria for choosing this number: it should be high enough to make the +// quit act like QuitWhenIdle, while taking into account that any page which is +// animating may be rendering another frame for each quit deferral. For an +// animating page, the potential delay to quitting the RunLoop would be +// kNumQuitDeferrals * frame_render_time. Some perf tests run slow, such as +// 200ms/frame. +static const int kNumQuitDeferrals = 10; + +static void DeferredQuitRunLoop(const base::Closure& quit_task, + int num_quit_deferrals) { + if (num_quit_deferrals <= 0) { + quit_task.Run(); + } else { + MessageLoop::current()->PostTask(FROM_HERE, + base::Bind(&DeferredQuitRunLoop, quit_task, num_quit_deferrals - 1)); + } +} + +} + +namespace content { + +void RunThisRunLoop(base::RunLoop* run_loop) { + MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); + + // If we're running inside a browser test, we might need to allow the test + // launcher to do extra work before/after running a nested message loop. + test_launcher::TestLauncherDelegate* delegate = + test_launcher::GetCurrentTestLauncherDelegate(); + if (delegate) + delegate->PreRunMessageLoop(run_loop); + run_loop->Run(); + if (delegate) + delegate->PostRunMessageLoop(); +} + +base::Closure GetQuitTaskForRunLoop(base::RunLoop* run_loop) { + return base::Bind(&DeferredQuitRunLoop, run_loop->QuitClosure(), + kNumQuitDeferrals); +} + +MessageLoopRunner::MessageLoopRunner() { +} + +MessageLoopRunner::~MessageLoopRunner() { +} + +void MessageLoopRunner::Run() { + RunThisRunLoop(&run_loop_); +} + +base::Closure MessageLoopRunner::QuitClosure() { + return base::Bind(&MessageLoopRunner::Quit, this); +} + +void MessageLoopRunner::Quit() { + GetQuitTaskForRunLoop(&run_loop_).Run(); +} + +WindowedNotificationObserver::WindowedNotificationObserver( + int notification_type, + const NotificationSource& source) + : seen_(false), + running_(false), + source_(NotificationService::AllSources()) { + registrar_.Add(this, notification_type, source); +} + +WindowedNotificationObserver::~WindowedNotificationObserver() {} + +void WindowedNotificationObserver::Wait() { + if (seen_) + return; + + running_ = true; + message_loop_runner_ = new MessageLoopRunner; + message_loop_runner_->Run(); + EXPECT_TRUE(seen_); +} + +void WindowedNotificationObserver::Observe( + int type, + const NotificationSource& source, + const NotificationDetails& details) { + source_ = source; + details_ = details; + seen_ = true; + if (!running_) + return; + + message_loop_runner_->Quit(); + running_ = false; +} + +} // namespace content |