diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-27 03:11:56 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-27 03:11:56 +0000 |
commit | 80b050cf2b5f38f77c51000f65c111bcc6ded331 (patch) | |
tree | 5d7dec7da50501b0fe4219e40e5a0e1082e13784 /content | |
parent | 83afcbcc9bf7be3cdf91a4a6af573638c042a694 (diff) | |
download | chromium_src-80b050cf2b5f38f77c51000f65c111bcc6ded331.zip chromium_src-80b050cf2b5f38f77c51000f65c111bcc6ded331.tar.gz chromium_src-80b050cf2b5f38f77c51000f65c111bcc6ded331.tar.bz2 |
Convert speech and session history browser_tests to run under content_browsertests.
Also add support for single-process.
BUG=90448
Review URL: https://chromiumcodereview.appspot.com/10820043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148711 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/session_history_browsertest.cc | 125 | ||||
-rw-r--r-- | content/browser/speech/speech_recognition_browsertest.cc | 44 | ||||
-rw-r--r-- | content/content_tests.gypi | 2 | ||||
-rw-r--r-- | content/shell/shell.h | 3 | ||||
-rw-r--r-- | content/test/content_browser_test.cc | 10 | ||||
-rw-r--r-- | content/test/content_browser_test.h | 4 |
6 files changed, 98 insertions, 90 deletions
diff --git a/content/browser/session_history_browsertest.cc b/content/browser/session_history_browsertest.cc index 176f7c7..232ad17 100644 --- a/content/browser/session_history_browsertest.cc +++ b/content/browser/session_history_browsertest.cc @@ -4,31 +4,34 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_commands.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/public/browser/navigation_controller.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.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_utils.h" +#include "content/shell/shell.h" +#include "content/test/content_browser_test.h" +#include "content/test/content_browser_test_utils.h" #include "net/test/test_server.h" #include "testing/gtest/include/gtest/gtest.h" -class SessionHistoryTest : public InProcessBrowserTest { +namespace content { + +class SessionHistoryTest : public ContentBrowserTest { protected: SessionHistoryTest() {} virtual void SetUpOnMainThread() { ASSERT_TRUE(test_server()->Start()); + NavigateToURL(shell(), GURL(chrome::kAboutBlankURL)); } // Simulate clicking a link. Only works on the frames.html testserver page. void ClickLink(std::string node_id) { GURL url("javascript:clickLink('" + node_id + "')"); - ui_test_utils::NavigateToURL(browser(), url); + NavigateToURL(shell(), url); } // Simulate filling in form data. Only works on the frames.html page with @@ -38,28 +41,28 @@ class SessionHistoryTest : public InProcessBrowserTest { // This will return immediately, but since the JS executes synchronously // on the renderer, it will complete before the next navigate message is // processed. - ui_test_utils::NavigateToURLWithDisposition(browser(), url, CURRENT_TAB, 0); + NavigateToURL(shell(), url); } // Simulate submitting a form. Only works on the frames.html page with // subframe = form.html, and on form.html itself. void SubmitForm(std::string node_id) { GURL url("javascript:submitForm('" + node_id + "')"); - ui_test_utils::NavigateToURL(browser(), url); + NavigateToURL(shell(), url); } // Navigate session history using history.go(distance). void JavascriptGo(std::string distance) { GURL url("javascript:history.go('" + distance + "')"); - ui_test_utils::NavigateToURL(browser(), url); + NavigateToURL(shell(), url); } std::string GetTabTitle() { - return UTF16ToASCII(chrome::GetActiveWebContents(browser())->GetTitle()); + return UTF16ToASCII(shell()->web_contents()->GetTitle()); } GURL GetTabURL() { - return chrome::GetActiveWebContents(browser())->GetURL(); + return shell()->web_contents()->GetURL(); } GURL GetURL(const std::string file) { @@ -69,25 +72,32 @@ class SessionHistoryTest : public InProcessBrowserTest { void NavigateAndCheckTitle(const char* filename, const std::string& expected_title) { string16 expected_title16(ASCIIToUTF16(expected_title)); - content::TitleWatcher title_watcher( - chrome::GetActiveWebContents(browser()), expected_title16); - ui_test_utils::NavigateToURL(browser(), GetURL(filename)); + TitleWatcher title_watcher(shell()->web_contents(), expected_title16); + NavigateToURL(shell(), GetURL(filename)); ASSERT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); } + bool CanGoBack() { + return shell()->web_contents()->GetController().CanGoBack(); + } + + bool CanGoForward() { + return shell()->web_contents()->GetController().CanGoForward(); + } + void GoBack() { - content::WindowedNotificationObserver load_stop_observer( - content::NOTIFICATION_LOAD_STOP, - content::NotificationService::AllSources()); - chrome::GoBack(browser(), CURRENT_TAB); + WindowedNotificationObserver load_stop_observer( + NOTIFICATION_LOAD_STOP, + NotificationService::AllSources()); + shell()->web_contents()->GetController().GoBack(); load_stop_observer.Wait(); } void GoForward() { - content::WindowedNotificationObserver load_stop_observer( - content::NOTIFICATION_LOAD_STOP, - content::NotificationService::AllSources()); - chrome::GoForward(browser(), CURRENT_TAB); + WindowedNotificationObserver load_stop_observer( + NOTIFICATION_LOAD_STOP, + NotificationService::AllSources()); + shell()->web_contents()->GetController().GoForward(); load_stop_observer.Wait(); } }; @@ -95,9 +105,7 @@ class SessionHistoryTest : public InProcessBrowserTest { // If this flakes, use http://crbug.com/61619 on windows and // http://crbug.com/102094 on mac. IN_PROC_BROWSER_TEST_F(SessionHistoryTest, BasicBackForward) { - // about:blank should be loaded first. - ASSERT_FALSE(chrome::CanGoBack(browser())); - EXPECT_EQ("about:blank", GetTabTitle()); + ASSERT_FALSE(CanGoBack()); ASSERT_NO_FATAL_FAILURE(NavigateAndCheckTitle("bot1.html", "bot1")); ASSERT_NO_FATAL_FAILURE(NavigateAndCheckTitle("bot2.html", "bot2")); @@ -121,7 +129,7 @@ IN_PROC_BROWSER_TEST_F(SessionHistoryTest, BasicBackForward) { // history is [blank, bot1, *bot3] - ASSERT_FALSE(chrome::CanGoForward(browser())); + ASSERT_FALSE(CanGoForward()); EXPECT_EQ("bot3", GetTabTitle()); GoBack(); @@ -130,7 +138,7 @@ IN_PROC_BROWSER_TEST_F(SessionHistoryTest, BasicBackForward) { GoBack(); EXPECT_EQ("about:blank", GetTabTitle()); - ASSERT_FALSE(chrome::CanGoBack(browser())); + ASSERT_FALSE(CanGoBack()); EXPECT_EQ("about:blank", GetTabTitle()); GoForward(); @@ -143,11 +151,7 @@ IN_PROC_BROWSER_TEST_F(SessionHistoryTest, BasicBackForward) { // Test that back/forward works when navigating in subframes. // If this flakes, use http://crbug.com/48833 IN_PROC_BROWSER_TEST_F(SessionHistoryTest, FrameBackForward) { - // about:blank should be loaded first. - GURL home(chrome::kAboutBlankURL); - ASSERT_FALSE(chrome::CanGoBack(browser())); - EXPECT_EQ("about:blank", GetTabTitle()); - EXPECT_EQ(GURL(chrome::kAboutBlankURL), GetTabURL()); + ASSERT_FALSE(CanGoBack()); ASSERT_NO_FATAL_FAILURE(NavigateAndCheckTitle("frames.html", "bot1")); @@ -172,7 +176,7 @@ IN_PROC_BROWSER_TEST_F(SessionHistoryTest, FrameBackForward) { GoBack(); EXPECT_EQ("about:blank", GetTabTitle()); - EXPECT_EQ(home, GetTabURL()); + EXPECT_EQ(GURL(chrome::kAboutBlankURL), GetTabURL()); GoForward(); EXPECT_EQ("bot1", GetTabTitle()); @@ -188,7 +192,7 @@ IN_PROC_BROWSER_TEST_F(SessionHistoryTest, FrameBackForward) { // history is [blank, bot1, bot2, *bot1] - ASSERT_FALSE(chrome::CanGoForward(browser())); + ASSERT_FALSE(CanGoForward()); EXPECT_EQ("bot1", GetTabTitle()); EXPECT_EQ(frames, GetTabURL()); @@ -204,9 +208,7 @@ IN_PROC_BROWSER_TEST_F(SessionHistoryTest, FrameBackForward) { // Test that back/forward preserves POST data and document state in subframes. // If this flakes use http://crbug.com/61619 IN_PROC_BROWSER_TEST_F(SessionHistoryTest, FrameFormBackForward) { - // about:blank should be loaded first. - ASSERT_FALSE(chrome::CanGoBack(browser())); - EXPECT_EQ("about:blank", GetTabTitle()); + ASSERT_FALSE(CanGoBack()); ASSERT_NO_FATAL_FAILURE(NavigateAndCheckTitle("frames.html", "bot1")); @@ -259,9 +261,7 @@ IN_PROC_BROWSER_TEST_F(SessionHistoryTest, FrameFormBackForward) { // across frames (ie, from frame -> nonframe). // Hangs, see http://crbug.com/45058. IN_PROC_BROWSER_TEST_F(SessionHistoryTest, CrossFrameFormBackForward) { - // about:blank should be loaded first. - ASSERT_FALSE(chrome::CanGoBack(browser())); - EXPECT_EQ("about:blank", GetTabTitle()); + ASSERT_FALSE(CanGoBack()); GURL frames(GetURL("frames.html")); ASSERT_NO_FATAL_FAILURE(NavigateAndCheckTitle("frames.html", "bot1")); @@ -297,9 +297,7 @@ IN_PROC_BROWSER_TEST_F(SessionHistoryTest, CrossFrameFormBackForward) { // navigations. Bug 730379. // If this flakes use http://crbug.com/61619. IN_PROC_BROWSER_TEST_F(SessionHistoryTest, FragmentBackForward) { - // about:blank should be loaded first. - ASSERT_FALSE(chrome::CanGoBack(browser())); - EXPECT_EQ("about:blank", GetTabTitle()); + ASSERT_FALSE(CanGoBack()); GURL fragment(GetURL("fragment.html")); ASSERT_NO_FATAL_FAILURE(NavigateAndCheckTitle("fragment.html", "fragment")); @@ -326,7 +324,7 @@ IN_PROC_BROWSER_TEST_F(SessionHistoryTest, FragmentBackForward) { // history is [blank, fragment, fragment#a, bot3] - ASSERT_FALSE(chrome::CanGoForward(browser())); + ASSERT_FALSE(CanGoForward()); EXPECT_EQ(GetURL("bot3.html"), GetTabURL()); GoBack(); @@ -345,9 +343,7 @@ IN_PROC_BROWSER_TEST_F(SessionHistoryTest, FragmentBackForward) { // TODO(brettw) bug 50648: fix flakyness. This test seems like it was failing // about 1/4 of the time on Vista by failing to execute JavascriptGo (see bug). IN_PROC_BROWSER_TEST_F(SessionHistoryTest, JavascriptHistory) { - // about:blank should be loaded first. - ASSERT_FALSE(chrome::CanGoBack(browser())); - EXPECT_EQ("about:blank", GetTabTitle()); + ASSERT_FALSE(CanGoBack()); ASSERT_NO_FATAL_FAILURE(NavigateAndCheckTitle("bot1.html", "bot1")); ASSERT_NO_FATAL_FAILURE(NavigateAndCheckTitle("bot2.html", "bot2")); @@ -375,7 +371,7 @@ IN_PROC_BROWSER_TEST_F(SessionHistoryTest, JavascriptHistory) { JavascriptGo("-3"); EXPECT_EQ("about:blank", GetTabTitle()); - ASSERT_FALSE(chrome::CanGoBack(browser())); + ASSERT_FALSE(CanGoBack()); EXPECT_EQ("about:blank", GetTabTitle()); JavascriptGo("1"); @@ -385,7 +381,7 @@ IN_PROC_BROWSER_TEST_F(SessionHistoryTest, JavascriptHistory) { // history is [blank, bot1, *bot3] - ASSERT_FALSE(chrome::CanGoForward(browser())); + ASSERT_FALSE(CanGoForward()); EXPECT_EQ("bot3", GetTabTitle()); JavascriptGo("-1"); @@ -394,7 +390,7 @@ IN_PROC_BROWSER_TEST_F(SessionHistoryTest, JavascriptHistory) { JavascriptGo("-1"); EXPECT_EQ("about:blank", GetTabTitle()); - ASSERT_FALSE(chrome::CanGoBack(browser())); + ASSERT_FALSE(CanGoBack()); EXPECT_EQ("about:blank", GetTabTitle()); JavascriptGo("1"); @@ -423,8 +419,7 @@ IN_PROC_BROWSER_TEST_F(SessionHistoryTest, LocationChangeInSubframe) { ASSERT_NO_FATAL_FAILURE(NavigateAndCheckTitle( "location_redirect.html", "Default Title")); - ui_test_utils::NavigateToURL( - browser(), GURL("javascript:void(frames[0].navigate())")); + NavigateToURL(shell(), GURL("javascript:void(frames[0].navigate())")); EXPECT_EQ("foo", GetTabTitle()); GoBack(); @@ -434,23 +429,23 @@ IN_PROC_BROWSER_TEST_F(SessionHistoryTest, LocationChangeInSubframe) { // http://code.google.com/p/chromium/issues/detail?id=56267 IN_PROC_BROWSER_TEST_F(SessionHistoryTest, HistoryLength) { int length; - ASSERT_TRUE(content::ExecuteJavaScriptAndExtractInt( - chrome::GetActiveWebContents(browser())->GetRenderViewHost(), + ASSERT_TRUE(ExecuteJavaScriptAndExtractInt( + shell()->web_contents()->GetRenderViewHost(), L"", L"domAutomationController.send(history.length)", &length)); EXPECT_EQ(1, length); - ui_test_utils::NavigateToURL(browser(), GetURL("title1.html")); + NavigateToURL(shell(), GetURL("title1.html")); - ASSERT_TRUE(content::ExecuteJavaScriptAndExtractInt( - chrome::GetActiveWebContents(browser())->GetRenderViewHost(), + ASSERT_TRUE(ExecuteJavaScriptAndExtractInt( + shell()->web_contents()->GetRenderViewHost(), L"", L"domAutomationController.send(history.length)", &length)); EXPECT_EQ(2, length); // Now test that history.length is updated when the navigation is committed. - ui_test_utils::NavigateToURL(browser(), GetURL("record_length.html")); + NavigateToURL(shell(), GetURL("record_length.html")); - ASSERT_TRUE(content::ExecuteJavaScriptAndExtractInt( - chrome::GetActiveWebContents(browser())->GetRenderViewHost(), + ASSERT_TRUE(ExecuteJavaScriptAndExtractInt( + shell()->web_contents()->GetRenderViewHost(), L"", L"domAutomationController.send(history.length)", &length)); EXPECT_EQ(3, length); @@ -458,10 +453,12 @@ IN_PROC_BROWSER_TEST_F(SessionHistoryTest, HistoryLength) { GoBack(); // Ensure history.length is properly truncated. - ui_test_utils::NavigateToURL(browser(), GetURL("title2.html")); + NavigateToURL(shell(), GetURL("title2.html")); - ASSERT_TRUE(content::ExecuteJavaScriptAndExtractInt( - chrome::GetActiveWebContents(browser())->GetRenderViewHost(), + ASSERT_TRUE(ExecuteJavaScriptAndExtractInt( + shell()->web_contents()->GetRenderViewHost(), L"", L"domAutomationController.send(history.length)", &length)); EXPECT_EQ(2, length); } + +} // namespace content diff --git a/content/browser/speech/speech_recognition_browsertest.cc b/content/browser/speech/speech_recognition_browsertest.cc index 9d62a17..1497201 100644 --- a/content/browser/speech/speech_recognition_browsertest.cc +++ b/content/browser/speech/speech_recognition_browsertest.cc @@ -6,13 +6,10 @@ #include "base/command_line.h" #include "base/file_path.h" #include "base/memory/scoped_ptr.h" +#include "base/message_loop.h" #include "base/string_number_conversions.h" #include "base/synchronization/waitable_event.h" #include "base/utf_string_conversions.h" -#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/browser/speech/input_tag_speech_dispatcher_host.h" #include "content/browser/web_contents/web_contents_impl.h" @@ -20,9 +17,15 @@ #include "content/public/browser/speech_recognition_manager.h" #include "content/public/browser/speech_recognition_session_config.h" #include "content/public/browser/speech_recognition_session_context.h" +#include "content/public/browser/web_contents.h" #include "content/public/common/content_switches.h" #include "content/public/common/speech_recognition_error.h" #include "content/public/common/speech_recognition_result.h" +#include "content/public/common/url_constants.h" +#include "content/public/test/test_utils.h" +#include "content/shell/shell.h" +#include "content/test/content_browser_test.h" +#include "content/test/content_browser_test_utils.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" using content::SpeechRecognitionEventListener; @@ -181,25 +184,20 @@ class FakeSpeechRecognitionManager : public content::SpeechRecognitionManager { base::WaitableEvent recognition_started_event_; }; -class SpeechRecognitionBrowserTest : public InProcessBrowserTest { +class SpeechRecognitionBrowserTest : public content::ContentBrowserTest { public: - // InProcessBrowserTest methods + // ContentBrowserTest methods virtual void SetUpCommandLine(CommandLine* command_line) { EXPECT_TRUE(!command_line->HasSwitch(switches::kDisableSpeechInput)); } - GURL testUrl(const FilePath::CharType* filename) { - const FilePath kTestDir(FILE_PATH_LITERAL("speech")); - return ui_test_utils::GetTestUrl(kTestDir, FilePath(filename)); - } - protected: - void LoadAndStartSpeechRecognitionTest(const FilePath::CharType* filename) { + void LoadAndStartSpeechRecognitionTest(const char* filename) { // The test page calculates the speech button's coordinate in the page on // load & sets that coordinate in the URL fragment. We send mouse down & up // events at that coordinate to trigger speech recognition. - GURL test_url = testUrl(filename); - ui_test_utils::NavigateToURL(browser(), test_url); + GURL test_url = content::GetTestUrl("speech", filename); + content::NavigateToURL(shell(), test_url); WebKit::WebMouseEvent mouse_event; mouse_event.type = WebKit::WebInputEvent::MouseDown; @@ -207,7 +205,7 @@ class SpeechRecognitionBrowserTest : public InProcessBrowserTest { mouse_event.x = 0; mouse_event.y = 0; mouse_event.clickCount = 1; - WebContents* web_contents = chrome::GetActiveWebContents(browser()); + WebContents* web_contents = shell()->web_contents(); content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, @@ -224,16 +222,16 @@ class SpeechRecognitionBrowserTest : public InProcessBrowserTest { observer.Wait(); } - void RunSpeechRecognitionTest(const FilePath::CharType* filename) { + void RunSpeechRecognitionTest(const char* filename) { // The fake speech input manager would receive the speech input // request and return the test string as recognition result. The test page // then sets the URL fragment as 'pass' if it received the expected string. LoadAndStartSpeechRecognitionTest(filename); - EXPECT_EQ("pass", chrome::GetActiveWebContents(browser())->GetURL().ref()); + EXPECT_EQ("pass", shell()->web_contents()->GetURL().ref()); } - // InProcessBrowserTest methods. + // ContentBrowserTest methods. virtual void SetUpInProcessBrowserTestFixture() { fake_speech_recognition_manager_.set_should_send_fake_response(true); speech_recognition_manager_ = &fake_speech_recognition_manager_; @@ -268,12 +266,12 @@ content::SpeechRecognitionManager* // a renderer crashes, we get a call to // SpeechRecognitionManager::CancelAllRequestsWithDelegate. IN_PROC_BROWSER_TEST_F(SpeechRecognitionBrowserTest, TestBasicRecognition) { - RunSpeechRecognitionTest(FILE_PATH_LITERAL("basic_recognition.html")); + RunSpeechRecognitionTest("basic_recognition.html"); EXPECT_TRUE(fake_speech_recognition_manager_.grammar().empty()); } IN_PROC_BROWSER_TEST_F(SpeechRecognitionBrowserTest, GrammarAttribute) { - RunSpeechRecognitionTest(FILE_PATH_LITERAL("grammar_attribute.html")); + RunSpeechRecognitionTest("grammar_attribute.html"); EXPECT_EQ("http://example.com/grammar.xml", fake_speech_recognition_manager_.grammar()); } @@ -285,13 +283,11 @@ IN_PROC_BROWSER_TEST_F(SpeechRecognitionBrowserTest, TestCancelAll) { // test page JavaScript in this case. fake_speech_recognition_manager_.set_should_send_fake_response(false); - LoadAndStartSpeechRecognitionTest( - FILE_PATH_LITERAL("basic_recognition.html")); + LoadAndStartSpeechRecognitionTest("basic_recognition.html"); // Make the renderer crash. This should trigger // InputTagSpeechDispatcherHost to cancel all pending sessions. - GURL test_url("about:crash"); - ui_test_utils::NavigateToURL(browser(), test_url); + content::NavigateToURL(shell(), GURL(chrome::kChromeUICrashURL)); EXPECT_TRUE(fake_speech_recognition_manager_.did_cancel_all()); } diff --git a/content/content_tests.gypi b/content/content_tests.gypi index a973c80..d897ef5 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -570,6 +570,8 @@ 'browser/plugin_browsertest.cc', 'browser/plugin_service_impl_browsertest.cc', 'browser/renderer_host/render_view_host_browsertest.cc', + 'browser/session_history_browsertest.cc', + 'browser/speech/speech_recognition_browsertest.cc', 'browser/webkit_browsertest.cc', 'browser/worker_host/test/worker_browsertest.cc', 'renderer/mouse_lock_dispatcher_browsertest.cc', diff --git a/content/shell/shell.h b/content/shell/shell.h index 1ac10fc..d8cbc35 100644 --- a/content/shell/shell.h +++ b/content/shell/shell.h @@ -27,13 +27,12 @@ typedef struct _GtkToolItem GtkToolItem; #endif class GURL; -class WebContents; - namespace content { class BrowserContext; class ShellJavaScriptDialogCreator; class SiteInstance; +class WebContents; // This represents one window of the Content Shell, i.e. all the UI including // buttons and url bar, as well as the web content area. diff --git a/content/test/content_browser_test.cc b/content/test/content_browser_test.cc index 6ba8a3f..0fab44b 100644 --- a/content/test/content_browser_test.cc +++ b/content/test/content_browser_test.cc @@ -16,6 +16,7 @@ #include "content/shell/shell.h" #include "content/shell/shell_browser_context.h" #include "content/shell/shell_content_browser_client.h" +#include "content/shell/shell_content_renderer_client.h" #include "content/shell/shell_main_delegate.h" #include "content/shell/shell_switches.h" #include "content/test/test_content_client.h" @@ -56,6 +57,15 @@ void ContentBrowserTest::SetUp() { SetUpCommandLine(command_line); + // Single-process mode is not set in BrowserMain, so process it explicitly, + // and set up renderer. + if (command_line->HasSwitch(switches::kSingleProcess)) { + RenderProcessHost::set_run_renderer_in_process(true); + single_process_renderer_client_.reset(new ShellContentRendererClient); + content::GetContentClient()->set_renderer_for_testing( + single_process_renderer_client_.get()); + } + #if defined(OS_MACOSX) // See InProcessBrowserTest::PrepareTestCommandLine(). FilePath subprocess_path; diff --git a/content/test/content_browser_test.h b/content/test/content_browser_test.h index c9b6da2..5870bb0 100644 --- a/content/test/content_browser_test.h +++ b/content/test/content_browser_test.h @@ -12,6 +12,7 @@ class GURL; namespace content { +class ContentRendererClient; class Shell; class ShellMainDelegate; @@ -41,6 +42,9 @@ class ContentBrowserTest : public BrowserTestBase { scoped_ptr<content::ShellMainDelegate> shell_main_delegate_; Shell* shell_; + + // ContentRendererClient when running in single-process mode. + scoped_ptr<ContentRendererClient> single_process_renderer_client_; }; } // namespace content |