diff options
25 files changed, 104 insertions, 96 deletions
diff --git a/chrome/browser/browser_encoding_browsertest.cc b/chrome/browser/browser_encoding_browsertest.cc index 07f9df7..1b68a9f 100644 --- a/chrome/browser/browser_encoding_browsertest.cc +++ b/chrome/browser/browser_encoding_browsertest.cc @@ -19,8 +19,8 @@ #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" #include "content/public/browser/web_contents.h" +#include "content/public/test/test_navigation_observer.h" #include "content/test/net/url_request_mock_http_job.h" -#include "content/test/test_navigation_observer.h" using content::BrowserThread; @@ -160,7 +160,7 @@ IN_PROC_BROWSER_TEST_F(BrowserEncodingTest, TestOverrideEncoding) { // Override the encoding to "gb18030". const std::string selected_encoding = CharacterEncoding::GetCanonicalEncodingNameByAliasName("gb18030"); - TestNavigationObserver navigation_observer( + content::TestNavigationObserver navigation_observer( content::Source<content::NavigationController>( &web_contents->GetController())); web_contents->SetOverrideEncoding(selected_encoding); @@ -277,7 +277,7 @@ IN_PROC_BROWSER_TEST_F(BrowserEncodingTest, MAYBE_TestEncodingAutoDetect) { browser()->profile()->GetPrefs()->SetBoolean( prefs::kWebKitUsesUniversalDetector, true); - TestNavigationObserver observer( + content::TestNavigationObserver observer( content::Source<content::NavigationController>( &web_contents->GetController())); browser()->Reload(CURRENT_TAB); diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index 25c86e8..26dcdaa 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc @@ -56,10 +56,10 @@ #include "content/public/browser/web_contents.h" #include "content/public/common/context_menu_params.h" #include "content/public/common/page_transition_types.h" +#include "content/public/test/test_navigation_observer.h" #include "content/test/net/url_request_mock_http_job.h" #include "content/test/net/url_request_slow_download_job.h" #include "content/test/test_file_error_injector.h" -#include "content/test/test_navigation_observer.h" #include "net/base/net_util.h" #include "net/test/test_server.h" #include "testing/gtest/include/gtest/gtest.h" @@ -971,7 +971,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadResourceThrottleCancels) { // Try to start the download via Javascript and wait for the corresponding // load stop event. - TestNavigationObserver observer( + content::TestNavigationObserver observer( content::Source<content::NavigationController>( &web_contents->GetController()), NULL, diff --git a/chrome/browser/errorpage_browsertest.cc b/chrome/browser/errorpage_browsertest.cc index 9232904..e69f4a4 100644 --- a/chrome/browser/errorpage_browsertest.cc +++ b/chrome/browser/errorpage_browsertest.cc @@ -10,9 +10,9 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/web_contents.h" +#include "content/public/test/test_navigation_observer.h" #include "content/test/net/url_request_failed_job.h" #include "content/test/net/url_request_mock_http_job.h" -#include "content/test/test_navigation_observer.h" #include "net/base/net_errors.h" using content::BrowserThread; @@ -87,10 +87,10 @@ class ErrorPageTest : public InProcessBrowserTest { browser()->GetSelectedWebContents(), ASCIIToUTF16(expected_title)); - TestNavigationObserver test_navigation_observer( - content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->web_contents()-> - GetController()), + content::TestNavigationObserver test_navigation_observer( + content::Source<NavigationController>( + &browser()->GetSelectedTabContentsWrapper()->web_contents()-> + GetController()), NULL, num_navigations); if (direction == HISTORY_NAVIGATE_BACK) { diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc index 0da843a..78481ba 100644 --- a/chrome/browser/extensions/app_process_apitest.cc +++ b/chrome/browser/extensions/app_process_apitest.cc @@ -23,7 +23,7 @@ #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" -#include "content/test/test_navigation_observer.h" +#include "content/public/test/test_navigation_observer.h" #include "net/base/mock_host_resolver.h" using content::NavigationController; @@ -481,10 +481,10 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, OpenAppFromExtension) { // 1. The extension launcher page. // 2. The URL that the extension launches, which redirects. // 3. The app's URL. - TestNavigationObserver test_navigation_observer( - content::NotificationService::AllSources(), - NULL, - 3); + content::TestNavigationObserver test_navigation_observer( + content::NotificationService::AllSources(), + NULL, + 3); // Load the launcher extension, which should launch the app. ui_test_utils::NavigateToURLWithDisposition( diff --git a/chrome/browser/history/redirect_browsertest.cc b/chrome/browser/history/redirect_browsertest.cc index 239232f..db79292 100644 --- a/chrome/browser/history/redirect_browsertest.cc +++ b/chrome/browser/history/redirect_browsertest.cc @@ -24,7 +24,7 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/web_contents.h" -#include "content/test/test_navigation_observer.h" +#include "content/public/test/test_navigation_observer.h" #include "net/base/net_util.h" #include "net/test/test_server.h" #include "ui/base/events.h" @@ -153,7 +153,7 @@ IN_PROC_BROWSER_TEST_F(RedirectTest, ClientCancelled) { ui_test_utils::NavigateToURL(browser(), first_url); content::WebContents* web_contents = browser()->GetSelectedWebContents(); - TestNavigationObserver navigation_observer( + content::TestNavigationObserver navigation_observer( content::Source<content::NavigationController>( &web_contents->GetController())); @@ -266,7 +266,7 @@ IN_PROC_BROWSER_TEST_F(RedirectTest, "client-redirect?" + slow.spec()); content::WebContents* web_contents = browser()->GetSelectedWebContents(); - TestNavigationObserver observer( + content::TestNavigationObserver observer( content::Source<content::NavigationController>( &web_contents->GetController()), NULL, 2); diff --git a/chrome/browser/repost_form_warning_browsertest.cc b/chrome/browser/repost_form_warning_browsertest.cc index 60cc1a1..97dc346 100644 --- a/chrome/browser/repost_form_warning_browsertest.cc +++ b/chrome/browser/repost_form_warning_browsertest.cc @@ -14,7 +14,7 @@ #include "chrome/test/ui/ui_test.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/web_contents.h" -#include "content/test/test_navigation_observer.h" +#include "content/public/test/test_navigation_observer.h" #include "net/test/test_server.h" typedef InProcessBrowserTest RepostFormWarningTest; @@ -86,7 +86,7 @@ IN_PROC_BROWSER_TEST_F(RepostFormWarningTest, TestLoginAfterRepost) { // because that waits for the current page to stop loading first, which won't // happen while the auth dialog is up. content::Source<content::NavigationController> source(&controller); - TestNavigationObserver navigation_observer(source); + content::TestNavigationObserver navigation_observer(source); browser()->OpenURL(content::OpenURLParams( test_server()->GetURL("bar"), content::Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); diff --git a/chrome/browser/sessions/session_restore_browsertest.cc b/chrome/browser/sessions/session_restore_browsertest.cc index 11286fe..3d58b2d 100644 --- a/chrome/browser/sessions/session_restore_browsertest.cc +++ b/chrome/browser/sessions/session_restore_browsertest.cc @@ -31,7 +31,7 @@ #include "content/public/browser/render_process_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/page_transition_types.h" -#include "content/test/test_navigation_observer.h" +#include "content/public/test/test_navigation_observer.h" #if defined(OS_MACOSX) #include "base/mac/scoped_nsautorelease_pool.h" @@ -108,7 +108,7 @@ class SessionRestoreTest : public InProcessBrowserTest { // Create a new window, which should trigger session restore. ui_test_utils::BrowserAddedObserver window_observer; - TestNavigationObserver navigation_observer( + content::TestNavigationObserver navigation_observer( content::NotificationService::AllSources(), NULL, expected_tab_count); Browser::NewEmptyWindow(profile); Browser* new_browser = window_observer.WaitForSingleNewBrowser(); diff --git a/chrome/browser/ui/webui/bookmarks_ui_browsertest.cc b/chrome/browser/ui/webui/bookmarks_ui_browsertest.cc index e597425..3c7e564 100644 --- a/chrome/browser/ui/webui/bookmarks_ui_browsertest.cc +++ b/chrome/browser/ui/webui/bookmarks_ui_browsertest.cc @@ -11,7 +11,7 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/web_contents.h" -#include "content/test/test_navigation_observer.h" +#include "content/public/test/test_navigation_observer.h" class BookmarksTest : public InProcessBrowserTest { public: @@ -20,7 +20,7 @@ class BookmarksTest : public InProcessBrowserTest { } void OpenBookmarksManager() { - TestNavigationObserver navigation_observer( + content::TestNavigationObserver navigation_observer( content::NotificationService::AllSources(), NULL, 2); // Bring up the bookmarks manager tab. @@ -80,7 +80,7 @@ IN_PROC_BROWSER_TEST_F(BookmarksTest, CommandAgainGoesBackToBookmarksTab) { } IN_PROC_BROWSER_TEST_F(BookmarksTest, TwoCommandsOneTab) { - TestNavigationObserver navigation_observer( + content::TestNavigationObserver navigation_observer( content::NotificationService::AllSources()); browser()->OpenBookmarkManager(); browser()->OpenBookmarkManager(); 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 265c7bb..24d1d66 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc +++ b/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc @@ -12,7 +12,7 @@ #include "content/public/browser/notification_types.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/web_contents.h" -#include "content/test/test_navigation_observer.h" +#include "content/public/test/test_navigation_observer.h" #include "googleurl/src/gurl.h" using content::OpenURLParams; @@ -144,7 +144,8 @@ IN_PROC_BROWSER_TEST_F(NewTabUIProcessPerTabTest, NavBeforeNTPCommits) { // We don't use ui_test_utils::NavigateToURLWithDisposition because that waits // for current loading to stop. - TestNavigationObserver observer(content::NotificationService::AllSources()); + content::TestNavigationObserver observer( + content::NotificationService::AllSources()); browser()->OpenURL(OpenURLParams( GURL("data:text/html,hello world"), Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); 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 04b4214..629d094 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 @@ -11,7 +11,7 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" -#include "content/test/test_navigation_observer.h" +#include "content/public/test/test_navigation_observer.h" namespace { @@ -56,7 +56,7 @@ IN_PROC_BROWSER_TEST_F(PrintPreviewTest, PrintCommands) { ASSERT_TRUE( browser()->command_updater()->IsCommandEnabled(IDC_ADVANCED_PRINT)); - TestNavigationObserver reload_observer( + content::TestNavigationObserver reload_observer( content::NotificationService::AllSources()); browser()->Reload(CURRENT_TAB); reload_observer.Wait(); diff --git a/chrome/browser/ui/webui/web_ui_browsertest.cc b/chrome/browser/ui/webui/web_ui_browsertest.cc index 1efc0ade..e5551db 100644 --- a/chrome/browser/ui/webui/web_ui_browsertest.cc +++ b/chrome/browser/ui/webui/web_ui_browsertest.cc @@ -194,7 +194,7 @@ void WebUIBrowserTest::PreLoadJavascriptLibraries( } void WebUIBrowserTest::BrowsePreload(const GURL& browse_to) { - TestNavigationObserver navigation_observer( + content::TestNavigationObserver navigation_observer( content::Source<NavigationController>( &browser()->GetSelectedTabContentsWrapper()->web_contents()-> GetController()), diff --git a/chrome/browser/ui/webui/web_ui_browsertest.h b/chrome/browser/ui/webui/web_ui_browsertest.h index bc9e7b0..0d68faf 100644 --- a/chrome/browser/ui/webui/web_ui_browsertest.h +++ b/chrome/browser/ui/webui/web_ui_browsertest.h @@ -13,7 +13,7 @@ #include "base/memory/scoped_vector.h" #include "base/string16.h" #include "chrome/test/base/in_process_browser_test.h" -#include "content/test/js_injection_ready_observer.h" +#include "content/public/test/js_injection_ready_observer.h" namespace base { class Value; @@ -43,7 +43,7 @@ class WebUITestHandler; // and the lone test within this class. class WebUIBrowserTest : public InProcessBrowserTest, - public JsInjectionReadyObserver { + public content::JsInjectionReadyObserver { public: typedef ScopedVector<const base::Value> ConstValueVector; virtual ~WebUIBrowserTest(); @@ -146,7 +146,7 @@ class WebUIBrowserTest static GURL WebUITestDataPathToURL(const FilePath::StringType& path); private: - // JsInjectionReadyObserver implementation. + // content::JsInjectionReadyObserver implementation. virtual void OnJsInjectionReady( content::RenderViewHost* render_view_host) OVERRIDE; diff --git a/chrome/test/base/chrome_test_suite.h b/chrome/test/base/chrome_test_suite.h index 9337b7e..e2f9557 100644 --- a/chrome/test/base/chrome_test_suite.h +++ b/chrome/test/base/chrome_test_suite.h @@ -10,7 +10,7 @@ #include "base/file_path.h" #include "base/memory/scoped_ptr.h" -#include "content/test/content_test_suite_base.h" +#include "content/public/test/content_test_suite_base.h" #if defined(OS_WIN) #include "ui/base/win/scoped_ole_initializer.h" diff --git a/chrome/test/base/test_tab_strip_model_observer.cc b/chrome/test/base/test_tab_strip_model_observer.cc index c7b8d3d..510d6e6 100644 --- a/chrome/test/base/test_tab_strip_model_observer.cc +++ b/chrome/test/base/test_tab_strip_model_observer.cc @@ -16,7 +16,7 @@ using content::NavigationController; TestTabStripModelObserver::TestTabStripModelObserver( TabStripModel* tab_strip_model, - JsInjectionReadyObserver* js_injection_ready_observer) + content::JsInjectionReadyObserver* js_injection_ready_observer) : TestNavigationObserver(js_injection_ready_observer, 1), tab_strip_model_(tab_strip_model) { tab_strip_model_->AddObserver(this); diff --git a/chrome/test/base/test_tab_strip_model_observer.h b/chrome/test/base/test_tab_strip_model_observer.h index d28153e..03aa7a9 100644 --- a/chrome/test/base/test_tab_strip_model_observer.h +++ b/chrome/test/base/test_tab_strip_model_observer.h @@ -8,7 +8,7 @@ #include "base/compiler_specific.h" #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" -#include "content/test/test_navigation_observer.h" +#include "content/public/test/test_navigation_observer.h" class TabStripModel; @@ -19,14 +19,14 @@ class TabStripModel; // the framework & registration javascript before the webui page loads by // calling back through the TestTabStripModelObserver::LoadStartObserver when // the new page starts loading. -class TestTabStripModelObserver : public TestNavigationObserver, +class TestTabStripModelObserver : public content::TestNavigationObserver, public TabStripModelObserver { public: // Observe the |tab_strip_model|, which may not be NULL. If // |load_start_observer| is non-NULL, notify when the page load starts. TestTabStripModelObserver( TabStripModel* tab_strip_model, - JsInjectionReadyObserver* js_injection_ready_observer); + content::JsInjectionReadyObserver* js_injection_ready_observer); virtual ~TestTabStripModelObserver(); private: diff --git a/chrome/test/base/test_web_dialog_observer.cc b/chrome/test/base/test_web_dialog_observer.cc index 11ba496..2056592 100644 --- a/chrome/test/base/test_web_dialog_observer.cc +++ b/chrome/test/base/test_web_dialog_observer.cc @@ -4,7 +4,6 @@ #include "chrome/test/base/test_web_dialog_observer.h" -#include "content/test/js_injection_ready_observer.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/navigation_controller.h" @@ -13,11 +12,12 @@ #include "content/public/browser/notification_types.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" +#include "content/public/test/js_injection_ready_observer.h" using content::NavigationController; TestWebDialogObserver::TestWebDialogObserver( - JsInjectionReadyObserver* js_injection_ready_observer) + content::JsInjectionReadyObserver* js_injection_ready_observer) : js_injection_ready_observer_(js_injection_ready_observer), web_ui_(NULL), done_(false), diff --git a/chrome/test/base/test_web_dialog_observer.h b/chrome/test/base/test_web_dialog_observer.h index 3fef7fb..b77d667 100644 --- a/chrome/test/base/test_web_dialog_observer.h +++ b/chrome/test/base/test_web_dialog_observer.h @@ -12,9 +12,9 @@ #include "content/public/browser/notification_registrar.h" #include "ui/web_dialogs/web_dialog_observer.h" -class JsInjectionReadyObserver; namespace content { +class JsInjectionReadyObserver; class RenderViewHost; class WebUI; } @@ -29,7 +29,7 @@ class TestWebDialogObserver : public content::NotificationObserver, // |js_injection_ready_observer| is non-NULL, notify it as soon as the RVH is // available. explicit TestWebDialogObserver( - JsInjectionReadyObserver* js_injection_ready_observer); + content::JsInjectionReadyObserver* js_injection_ready_observer); virtual ~TestWebDialogObserver(); // Overridden from WebDialogObserver: @@ -51,7 +51,7 @@ class TestWebDialogObserver : public content::NotificationObserver, // Observer to take some action when the dialog is ready for JavaScript // injection. - JsInjectionReadyObserver* js_injection_ready_observer_; + content::JsInjectionReadyObserver* js_injection_ready_observer_; content::WebUI* web_ui_; bool done_; bool running_; diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc index c1b4619..a6b4980 100644 --- a/chrome/test/base/ui_test_utils.cc +++ b/chrome/test/base/ui_test_utils.cc @@ -60,7 +60,7 @@ #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_view.h" #include "content/public/common/geoposition.h" -#include "content/test/test_navigation_observer.h" +#include "content/public/test/test_navigation_observer.h" #include "googleurl/src/gurl.h" #include "net/base/net_util.h" #include "net/test/python_utils.h" @@ -326,7 +326,7 @@ bool GetCurrentTabTitle(const Browser* browser, string16* title) { void WaitForNavigations(NavigationController* controller, int number_of_navigations) { - TestNavigationObserver observer( + content::TestNavigationObserver observer( content::Source<NavigationController>(controller), NULL, number_of_navigations); observer.WaitForObservation( @@ -386,7 +386,7 @@ void OpenURLOffTheRecord(Profile* profile, const GURL& url) { } void NavigateToURL(browser::NavigateParams* params) { - TestNavigationObserver observer( + content::TestNavigationObserver observer( content::NotificationService::AllSources(), NULL, 1); browser::Navigate(params); observer.WaitForObservation( @@ -416,7 +416,7 @@ static void NavigateToURLWithDispositionBlockUntilNavigationsComplete( NavigationController* controller = browser->GetSelectedWebContents() ? &browser->GetSelectedWebContents()->GetController() : NULL; - TestNavigationObserver same_tab_observer( + content::TestNavigationObserver same_tab_observer( content::Source<NavigationController>(controller), NULL, number_of_navigations); diff --git a/content/content_tests.gypi b/content/content_tests.gypi index bfa8c0b..4784c82 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -27,6 +27,9 @@ 'sources': [ 'public/test/accessibility_test_utils_win.h', 'public/test/browser_test.h', + 'public/test/content_test_suite_base.h', + 'public/test/js_injection_ready_observer.h', + 'public/test/test_navigation_observer.h', # TODO(phajdan.jr): All of those files should live in content/test (if # they're only used by content) or content/public/test (if they're used # by other embedders). @@ -60,12 +63,10 @@ 'test/content_test_suite.cc', 'test/content_test_suite.h', 'test/content_test_suite_base.cc', - 'test/content_test_suite_base.h', 'test/gpu/gpu_test_config.cc', 'test/gpu/gpu_test_config.h', 'test/gpu/gpu_test_expectations_parser.cc', 'test/gpu/gpu_test_expectations_parser.h', - 'test/js_injection_ready_observer.h', 'test/mock_download_item.cc', 'test/mock_download_item.h', 'test/mock_download_manager.cc', @@ -101,7 +102,6 @@ 'test/test_file_error_injector.cc', 'test/test_file_error_injector.h', 'test/test_navigation_observer.cc', - 'test/test_navigation_observer.h', 'test/test_notification_tracker.cc', 'test/test_notification_tracker.h', 'test/test_renderer_host.cc', diff --git a/content/test/content_test_suite_base.h b/content/public/test/content_test_suite_base.h index 31a9c8b..083330b 100644 --- a/content/test/content_test_suite_base.h +++ b/content/public/test/content_test_suite_base.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_TEST_CONTENT_TEST_SUITE_BASE_H_ -#define CONTENT_TEST_CONTENT_TEST_SUITE_BASE_H_ +#ifndef CONTENT_PUBLIC_TEST_CONTENT_TEST_SUITE_BASE_H_ +#define CONTENT_PUBLIC_TEST_CONTENT_TEST_SUITE_BASE_H_ #pragma once #include "base/basictypes.h" @@ -32,4 +32,4 @@ class ContentTestSuiteBase : public base::TestSuite { } // namespace content -#endif // CONTENT_TEST_CONTENT_TEST_SUITE_BASE_H_ +#endif // CONTENT_PUBLIC_TEST_CONTENT_TEST_SUITE_BASE_H_ diff --git a/content/test/js_injection_ready_observer.h b/content/public/test/js_injection_ready_observer.h index 76370b5..9081a5e 100644 --- a/content/test/js_injection_ready_observer.h +++ b/content/public/test/js_injection_ready_observer.h @@ -2,13 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_TEST_JS_INJECTION_READY_OBSERVER_H_ -#define CONTENT_TEST_JS_INJECTION_READY_OBSERVER_H_ +#ifndef CONTENT_PUBLIC_TEST_JS_INJECTION_READY_OBSERVER_H_ +#define CONTENT_PUBLIC_TEST_JS_INJECTION_READY_OBSERVER_H_ #pragma once namespace content { class RenderViewHost; -} // Interface to notify when JavaScript injection is possible. class JsInjectionReadyObserver { @@ -16,11 +15,12 @@ class JsInjectionReadyObserver { // Called to indicate page entry committed and ready for JavaScript // injection. |render_view_host| may be used to route injection messages to // the appropriate RenderView. - virtual void OnJsInjectionReady( - content::RenderViewHost* render_view_host) = 0; + virtual void OnJsInjectionReady(RenderViewHost* render_view_host) = 0; protected: virtual ~JsInjectionReadyObserver() {} }; -#endif // CONTENT_TEST_JS_INJECTION_READY_OBSERVER_H_ +} // namespace content + +#endif // CONTENT_PUBLIC_TEST_JS_INJECTION_READY_OBSERVER_H_ diff --git a/content/test/test_navigation_observer.h b/content/public/test/test_navigation_observer.h index 2bd9f40..180d415 100644 --- a/content/test/test_navigation_observer.h +++ b/content/public/test/test_navigation_observer.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_TEST_TEST_NAVIGATION_OBSERVER_H_ -#define CONTENT_TEST_TEST_NAVIGATION_OBSERVER_H_ +#ifndef CONTENT_PUBLIC_TEST_TEST_NAVIGATION_OBSERVER_H_ +#define CONTENT_PUBLIC_TEST_TEST_NAVIGATION_OBSERVER_H_ #pragma once #include "base/callback.h" @@ -12,6 +12,8 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +namespace content { + class JsInjectionReadyObserver; // For browser_tests, which run on the UI thread, run a second @@ -19,7 +21,7 @@ class JsInjectionReadyObserver; // WebUI tests that need to inject javascript, construct with a // JsInjectionReadyObserver and this class will call its // OnJsInjectionReady() at the appropriate time. -class TestNavigationObserver : public content::NotificationObserver { +class TestNavigationObserver : public NotificationObserver { public: class RVHOSendJS; @@ -28,11 +30,11 @@ class TestNavigationObserver : public content::NotificationObserver { // OnEntryCommitted() after |number_of_navigations| navigations. // Note: |js_injection_ready_observer| is owned by the caller and should be // valid until this class is destroyed. - TestNavigationObserver(const content::NotificationSource& source, + TestNavigationObserver(const NotificationSource& source, JsInjectionReadyObserver* js_injection_ready_observer, int number_of_navigations); // Like above but waits for one navigation. - explicit TestNavigationObserver(const content::NotificationSource& source); + explicit TestNavigationObserver(const NotificationSource& source); virtual ~TestNavigationObserver(); @@ -51,14 +53,14 @@ class TestNavigationObserver : public content::NotificationObserver { int number_of_navigations); // Register this TestNavigationObserver as an observer of the |source|. - void RegisterAsObserver(const content::NotificationSource& source); + void RegisterAsObserver(const NotificationSource& source); private: - // content::NotificationObserver: - virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + // NotificationObserver: + virtual void Observe(int type, const NotificationSource& source, + const NotificationDetails& details) OVERRIDE; - content::NotificationRegistrar registrar_; + NotificationRegistrar registrar_; // If true the navigation has started. bool navigation_started_; @@ -90,4 +92,6 @@ class TestNavigationObserver : public content::NotificationObserver { DISALLOW_COPY_AND_ASSIGN(TestNavigationObserver); }; -#endif // CONTENT_TEST_TEST_NAVIGATION_OBSERVER_H_ +} // namespace content + +#endif // CONTENT_PUBLIC_TEST_TEST_NAVIGATION_OBSERVER_H_ diff --git a/content/test/content_test_suite.h b/content/test/content_test_suite.h index d282182..390ed4c 100644 --- a/content/test/content_test_suite.h +++ b/content/test/content_test_suite.h @@ -8,7 +8,7 @@ #include "base/compiler_specific.h" #include "base/win/scoped_com_initializer.h" -#include "content/test/content_test_suite_base.h" +#include "content/public/test/content_test_suite_base.h" #if defined(USE_AURA) namespace aura { diff --git a/content/test/content_test_suite_base.cc b/content/test/content_test_suite_base.cc index 09738fb..adf2079 100644 --- a/content/test/content_test_suite_base.cc +++ b/content/test/content_test_suite_base.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/test/content_test_suite_base.h" +#include "content/public/test/content_test_suite_base.h" #include "base/basictypes.h" #include "base/compiler_specific.h" diff --git a/content/test/test_navigation_observer.cc b/content/test/test_navigation_observer.cc index c921ca7..89ff36f 100644 --- a/content/test/test_navigation_observer.cc +++ b/content/test/test_navigation_observer.cc @@ -2,30 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/test/test_navigation_observer.h" +#include "content/public/test/test_navigation_observer.h" #include "base/bind.h" #include "base/message_loop.h" #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/test/js_injection_ready_observer.h" +#include "content/public/test/js_injection_ready_observer.h" #include "testing/gtest/include/gtest/gtest.h" +namespace content { + // This class observes |render_view_host| and calls OnJsInjectionReady() of // |js_injection_ready_observer| when the time is right to inject JavaScript // into the page. -class TestNavigationObserver::RVHOSendJS - : public content::RenderViewHostObserver { +class TestNavigationObserver::RVHOSendJS : public RenderViewHostObserver { public: - RVHOSendJS(content::RenderViewHost* render_view_host, + RVHOSendJS(RenderViewHost* render_view_host, JsInjectionReadyObserver* js_injection_ready_observer) - : content::RenderViewHostObserver(render_view_host), + : RenderViewHostObserver(render_view_host), js_injection_ready_observer_(js_injection_ready_observer) { } private: - // content::RenderViewHostObserver implementation. + // RenderViewHostObserver implementation. virtual void RenderViewHostInitialized() OVERRIDE { if (js_injection_ready_observer_) js_injection_ready_observer_->OnJsInjectionReady(render_view_host()); @@ -37,7 +38,7 @@ class TestNavigationObserver::RVHOSendJS }; TestNavigationObserver::TestNavigationObserver( - const content::NotificationSource& source, + const NotificationSource& source, JsInjectionReadyObserver* js_injection_ready_observer, int number_of_navigations) : navigation_started_(false), @@ -49,14 +50,14 @@ TestNavigationObserver::TestNavigationObserver( // When javascript injection is requested, register for RenderViewHost // creation. if (js_injection_ready_observer_) { - registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED, - content::NotificationService::AllSources()); + registrar_.Add(this, NOTIFICATION_RENDER_VIEW_HOST_CREATED, + NotificationService::AllSources()); } RegisterAsObserver(source); } TestNavigationObserver::TestNavigationObserver( - const content::NotificationSource& source) + const NotificationSource& source) : navigation_started_(false), navigations_completed_(0), number_of_navigations_(1), @@ -102,30 +103,30 @@ TestNavigationObserver::TestNavigationObserver( // When javascript injection is requested, register for RenderViewHost // creation. if (js_injection_ready_observer_) { - registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED, - content::NotificationService::AllSources()); + registrar_.Add(this, NOTIFICATION_RENDER_VIEW_HOST_CREATED, + NotificationService::AllSources()); } } void TestNavigationObserver::RegisterAsObserver( - const content::NotificationSource& source) { + const NotificationSource& source) { // Register for events to know when we've finished loading the page and are // ready to quit the current message loop to return control back to the // waiting test. - registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, source); - registrar_.Add(this, content::NOTIFICATION_LOAD_START, source); - registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, source); + registrar_.Add(this, NOTIFICATION_NAV_ENTRY_COMMITTED, source); + registrar_.Add(this, NOTIFICATION_LOAD_START, source); + registrar_.Add(this, NOTIFICATION_LOAD_STOP, source); } void TestNavigationObserver::Observe( - int type, const content::NotificationSource& source, - const content::NotificationDetails& details) { + int type, const NotificationSource& source, + const NotificationDetails& details) { switch (type) { - case content::NOTIFICATION_NAV_ENTRY_COMMITTED: - case content::NOTIFICATION_LOAD_START: + case NOTIFICATION_NAV_ENTRY_COMMITTED: + case NOTIFICATION_LOAD_START: navigation_started_ = true; break; - case content::NOTIFICATION_LOAD_STOP: + case NOTIFICATION_LOAD_STOP: if (navigation_started_ && ++navigations_completed_ == number_of_navigations_) { navigation_started_ = false; @@ -134,12 +135,14 @@ void TestNavigationObserver::Observe( done_callback_.Run(); } break; - case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED: + case NOTIFICATION_RENDER_VIEW_HOST_CREATED: rvho_send_js_.reset(new RVHOSendJS( - content::Source<content::RenderViewHost>(source).ptr(), + Source<RenderViewHost>(source).ptr(), js_injection_ready_observer_)); break; default: NOTREACHED(); } } + +} // namespace content |