summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/shell/content_client/shell_browser_main_parts.cc2
-rw-r--r--chrome/browser_tests.isolate6
-rw-r--r--chrome/chrome_tests.gypi11
-rw-r--r--chrome/test/base/in_process_browser_test.cc8
-rw-r--r--chrome/test/base/in_process_browser_test.h8
-rw-r--r--chrome/test/base/ui_test_utils.cc17
-rw-r--r--chrome/test/base/ui_test_utils.h4
-rw-r--r--chrome/test/gpu/gpu_crash_browsertest.cc5
-rw-r--r--chrome/test/perf/dromaeo_benchmark_uitest.cc3
-rw-r--r--content/browser/in_process_webkit/indexed_db_layout_browsertest.cc1
-rw-r--r--content/browser/media_browsertest.cc18
-rw-r--r--content/browser/plugin_browsertest.cc19
-rw-r--r--content/browser/worker_host/test/worker_browsertest.cc89
-rw-r--r--content/content_tests.gypi9
-rw-r--r--content/public/test/browser_test_utils.h3
-rw-r--r--content/shell/shell_browser_context.cc5
-rw-r--r--content/shell/shell_browser_context.h3
-rw-r--r--content/shell/shell_browser_main_parts.cc4
-rw-r--r--content/shell/shell_browser_main_parts.h4
-rw-r--r--content/shell/shell_content_browser_client.cc5
-rw-r--r--content/shell/shell_content_browser_client.h4
-rw-r--r--content/shell/shell_resource_dispatcher_host_delegate.cc6
-rw-r--r--content/shell/shell_resource_dispatcher_host_delegate.h9
-rw-r--r--content/shell/shell_switches.cc2
-rw-r--r--content/shell/shell_switches.h1
-rw-r--r--content/test/browser_test_base.cc10
-rw-r--r--content/test/browser_test_base.h16
-rw-r--r--content/test/browser_test_utils.cc13
-rw-r--r--content/test/content_browser_test.cc26
-rw-r--r--content/test/content_browser_test.h10
-rw-r--r--content/test/layout_browsertest.cc19
-rw-r--r--content/test/layout_browsertest.h5
-rw-r--r--content/test/layout_test_http_server.cc (renamed from chrome/test/base/layout_test_http_server.cc)2
-rw-r--r--content/test/layout_test_http_server.h (renamed from chrome/test/base/layout_test_http_server.h)6
-rw-r--r--ui/views/examples/content_client/examples_browser_main_parts.cc2
35 files changed, 210 insertions, 145 deletions
diff --git a/ash/shell/content_client/shell_browser_main_parts.cc b/ash/shell/content_client/shell_browser_main_parts.cc
index 5c82bdf..9f4ad61 100644
--- a/ash/shell/content_client/shell_browser_main_parts.cc
+++ b/ash/shell/content_client/shell_browser_main_parts.cc
@@ -85,7 +85,7 @@ void ShellBrowserMainParts::PostMainMessageLoopStart() {
}
void ShellBrowserMainParts::PreMainMessageLoopRun() {
- browser_context_.reset(new content::ShellBrowserContext);
+ browser_context_.reset(new content::ShellBrowserContext(false));
// A ViewsDelegate is required.
if (!views::ViewsDelegate::views_delegate)
diff --git a/chrome/browser_tests.isolate b/chrome/browser_tests.isolate
index e78f970..43df7e2 100644
--- a/chrome/browser_tests.isolate
+++ b/chrome/browser_tests.isolate
@@ -587,12 +587,6 @@
'test/data/iframe_in_empty_frame.js',
'test/data/is_search_provider_installed.html',
'test/data/is_search_provider_installed_with_exception.html',
- 'test/data/media/bear.ogv',
- 'test/data/media/bear.webm',
- 'test/data/media/bear_pcm.wav',
- 'test/data/media/bear_silent.ogv',
- 'test/data/media/bear_silent.webm',
- 'test/data/media/player.html',
'test/data/navigate_opener.html',
'test/data/nosniff-test.html',
'test/data/nosniff-test.html.mock-http-headers',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 0ac766d..e22dfcd 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -336,8 +336,6 @@
'sources': [
'test/automation/proxy_launcher.cc',
'test/automation/proxy_launcher.h',
- 'test/base/layout_test_http_server.cc',
- 'test/base/layout_test_http_server.h',
'test/reliability/automated_ui_test_base.cc',
'test/reliability/automated_ui_test_base.h',
'test/ui/javascript_test_util.cc',
@@ -3008,8 +3006,6 @@
'renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc',
'renderer/safe_browsing/phishing_thumbnailer_browsertest.cc',
'renderer/translate_helper_browsertest.cc',
- 'test/base/layout_test_http_server.cc',
- 'test/base/layout_test_http_server.h',
'test/base/empty_browser_test.cc',
'test/base/in_process_browser_test_browsertest.cc',
'test/base/chrome_render_view_test.cc',
@@ -3054,17 +3050,13 @@
'../content/browser/accessibility/dump_accessibility_tree_helper.h',
'../content/browser/accessibility/dump_accessibility_tree_helper_mac.mm',
'../content/browser/accessibility/dump_accessibility_tree_helper_win.cc',
- '../content/browser/appcache/appcache_browsertest.cc',
- '../content/browser/audio_browsertest.cc',
'../content/browser/child_process_security_policy_browsertest.cc',
'../content/browser/device_orientation/device_orientation_browsertest.cc',
'../content/browser/dom_storage/dom_storage_browsertest.cc',
'../content/browser/download/mhtml_generation_browsertest.cc',
'../content/browser/fileapi/file_system_browsertest.cc',
'../content/browser/in_process_webkit/indexed_db_browsertest.cc',
- '../content/browser/in_process_webkit/indexed_db_layout_browsertest.cc',
'../content/browser/indexed_db/idbbindingutilities_browsertest.cc',
- '../content/browser/media_browsertest.cc',
'../content/browser/plugin_data_remover_impl_browsertest.cc',
'../content/browser/plugin_service_impl_browsertest.cc',
'../content/browser/renderer_host/render_process_host_browsertest.cc',
@@ -3074,15 +3066,12 @@
'../content/browser/session_history_browsertest.cc',
'../content/browser/speech/speech_recognition_browsertest.cc',
'../content/browser/webkit_browsertest.cc',
- '../content/browser/worker_host/test/worker_browsertest.cc',
'../content/public/test/render_widget_browsertest.h',
'../content/renderer/mouse_lock_dispatcher_browsertest.cc',
'../content/renderer/pepper/pepper_file_chooser_host_unittest.cc',
'../content/renderer/render_view_browsertest.cc',
'../content/renderer/render_view_browsertest_mac.mm',
'../content/renderer/renderer_accessibility_browsertest.cc',
- '../content/test/layout_browsertest.cc',
- '../content/test/layout_browsertest.h',
'../content/test/render_widget_browsertest.cc',
],
'rules': [
diff --git a/chrome/test/base/in_process_browser_test.cc b/chrome/test/base/in_process_browser_test.cc
index 5f4d40c..f3fa9a5 100644
--- a/chrome/test/base/in_process_browser_test.cc
+++ b/chrome/test/base/in_process_browser_test.cc
@@ -78,11 +78,7 @@ InProcessBrowserTest::InProcessBrowserTest()
chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath);
CHECK(PathService::Override(base::FILE_EXE, chrome_path));
#endif // defined(OS_MACOSX)
-
- test_server_.reset(new net::TestServer(
- net::TestServer::TYPE_HTTP,
- net::TestServer::kLocalhost,
- FilePath(FILE_PATH_LITERAL("chrome/test/data"))));
+ CreateTestServer("chrome/test/data");
}
InProcessBrowserTest::~InProcessBrowserTest() {
@@ -156,8 +152,6 @@ void InProcessBrowserTest::PrepareTestCommandLine(CommandLine* command_line) {
// Propagate commandline settings from test_launcher_utils.
test_launcher_utils::PrepareBrowserCommandLineForTests(command_line);
- command_line->AppendSwitch(switches::kDomAutomationController);
-
// This is a Browser test.
command_line->AppendSwitchASCII(switches::kTestType, kBrowserTestType);
diff --git a/chrome/test/base/in_process_browser_test.h b/chrome/test/base/in_process_browser_test.h
index 256e113..6b1f0d9 100644
--- a/chrome/test/base/in_process_browser_test.h
+++ b/chrome/test/base/in_process_browser_test.h
@@ -12,7 +12,6 @@
#include "content/public/common/page_transition_types.h"
#include "content/public/test/browser_test.h"
#include "content/test/browser_test_base.h"
-#include "net/test/test_server.h"
#include "testing/gtest/include/gtest/gtest.h"
#if defined(OS_CHROMEOS)
@@ -124,10 +123,6 @@ class InProcessBrowserTest : public BrowserTestBase {
// BrowserTestBase:
virtual void RunTestOnMainThreadLoop() OVERRIDE;
- // Returns the testing server. Guaranteed to be non-NULL.
- const net::TestServer* test_server() const { return test_server_.get(); }
- net::TestServer* test_server() { return test_server_.get(); }
-
// Creates a browser with a single tab (about:blank), waits for the tab to
// finish loading and shows the browser.
//
@@ -195,9 +190,6 @@ class InProcessBrowserTest : public BrowserTestBase {
// Browser created from CreateBrowser.
Browser* browser_;
- // Testing server, started on demand.
- scoped_ptr<net::TestServer> test_server_;
-
// ContentRendererClient when running in single-process mode.
scoped_ptr<content::ContentRendererClient> single_process_renderer_client_;
diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc
index d702a48..77c3148 100644
--- a/chrome/test/base/ui_test_utils.cc
+++ b/chrome/test/base/ui_test_utils.cc
@@ -289,18 +289,12 @@ static void NavigateToURLWithDispositionBlockUntilNavigationsComplete(
chrome::NOTIFICATION_TAB_ADDED,
content::NotificationService::AllSources());
- content::WindowedNotificationObserver auth_observer(
- chrome::NOTIFICATION_AUTH_NEEDED,
- content::NotificationService::AllSources());
-
browser->OpenURL(OpenURLParams(
url, Referrer(), disposition, content::PAGE_TRANSITION_TYPED, false));
if (browser_test_flags & BROWSER_TEST_WAIT_FOR_BROWSER)
browser = WaitForBrowserNotInSet(initial_browsers);
if (browser_test_flags & BROWSER_TEST_WAIT_FOR_TAB)
tab_added_observer.Wait();
- if (browser_test_flags & BROWSER_TEST_WAIT_FOR_AUTH)
- auth_observer.Wait();
if (!(browser_test_flags & BROWSER_TEST_WAIT_FOR_NAVIGATION)) {
// Some other flag caused the wait prior to this.
return;
@@ -369,17 +363,6 @@ GURL GetTestUrl(const FilePath& dir, const FilePath& file) {
return net::FilePathToFileURL(GetTestFilePath(dir, file));
}
-GURL GetFileUrlWithQuery(const FilePath& path,
- const std::string& query_string) {
- GURL url = net::FilePathToFileURL(path);
- if (!query_string.empty()) {
- GURL::Replacements replacements;
- replacements.SetQueryStr(query_string);
- return url.ReplaceComponents(replacements);
- }
- return url;
-}
-
AppModalDialog* WaitForAppModalDialog() {
content::WindowedNotificationObserver observer(
chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN,
diff --git a/chrome/test/base/ui_test_utils.h b/chrome/test/base/ui_test_utils.h
index 32e59fc..e7b4972 100644
--- a/chrome/test/base/ui_test_utils.h
+++ b/chrome/test/base/ui_test_utils.h
@@ -75,7 +75,6 @@ enum BrowserTestWaitFlags {
BROWSER_TEST_WAIT_FOR_BROWSER = 1 << 0, // Wait for a new browser.
BROWSER_TEST_WAIT_FOR_TAB = 1 << 1, // Wait for a new tab.
BROWSER_TEST_WAIT_FOR_NAVIGATION = 1 << 2, // Wait for navigation to finish.
- BROWSER_TEST_WAIT_FOR_AUTH = 1 << 3, // Wait for auth prompt.
BROWSER_TEST_MASK = BROWSER_TEST_WAIT_FOR_BROWSER |
BROWSER_TEST_WAIT_FOR_TAB |
@@ -150,9 +149,6 @@ FilePath GetTestFilePath(const FilePath& dir, const FilePath& file);
// The returned path is GURL format.
GURL GetTestUrl(const FilePath& dir, const FilePath& file);
-// Generate a URL for a file path including a query string.
-GURL GetFileUrlWithQuery(const FilePath& path, const std::string& query_string);
-
// Blocks until an application modal dialog is showns and returns it.
AppModalDialog* WaitForAppModalDialog();
diff --git a/chrome/test/gpu/gpu_crash_browsertest.cc b/chrome/test/gpu/gpu_crash_browsertest.cc
index 926b9f5..941d73b 100644
--- a/chrome/test/gpu/gpu_crash_browsertest.cc
+++ b/chrome/test/gpu/gpu_crash_browsertest.cc
@@ -13,6 +13,7 @@
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/test_launcher_utils.h"
#include "chrome/test/base/ui_test_utils.h"
+#include "content/public/test/browser_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gl/gl_implementation.h"
@@ -50,7 +51,7 @@ IN_PROC_BROWSER_TEST_F(GPUCrashTest, DISABLED_Kill) {
ui_test_utils::NavigateToURL(
browser(),
- ui_test_utils::GetFileUrlWithQuery(
+ content::GetFileUrlWithQuery(
gpu_test_dir_.AppendASCII("webgl.html"), "query=kill"));
SimulateGPUCrash(browser());
@@ -65,7 +66,7 @@ IN_PROC_BROWSER_TEST_F(GPUCrashTest, WebkitLoseContext) {
ui_test_utils::NavigateToURL(
browser(),
- ui_test_utils::GetFileUrlWithQuery(
+ content::GetFileUrlWithQuery(
gpu_test_dir_.AppendASCII("webgl.html"),
"query=WEBGL_lose_context"));
diff --git a/chrome/test/perf/dromaeo_benchmark_uitest.cc b/chrome/test/perf/dromaeo_benchmark_uitest.cc
index 74b6222..6af08f4 100644
--- a/chrome/test/perf/dromaeo_benchmark_uitest.cc
+++ b/chrome/test/perf/dromaeo_benchmark_uitest.cc
@@ -16,6 +16,7 @@
#include "chrome/test/perf/perf_test.h"
#include "chrome/test/ui/javascript_test_util.h"
#include "chrome/test/ui/ui_perf_test.h"
+#include "content/public/test/browser_test_utils.h"
#include "googleurl/src/gurl.h"
#include "net/base/net_util.h"
@@ -36,7 +37,7 @@ class DromaeoTest : public UIPerfTest {
FilePath test_path = GetDromaeoDir();
std::string query_string = suite + "&automated";
test_path = test_path.Append(FILE_PATH_LITERAL("index.html"));
- GURL test_url(ui_test_utils::GetFileUrlWithQuery(test_path, query_string));
+ GURL test_url(content::GetFileUrlWithQuery(test_path, query_string));
scoped_refptr<TabProxy> tab(GetActiveTab());
ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(test_url));
diff --git a/content/browser/in_process_webkit/indexed_db_layout_browsertest.cc b/content/browser/in_process_webkit/indexed_db_layout_browsertest.cc
index b2f0cf5..620714b 100644
--- a/content/browser/in_process_webkit/indexed_db_layout_browsertest.cc
+++ b/content/browser/in_process_webkit/indexed_db_layout_browsertest.cc
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/file_path.h"
#include "content/test/layout_browsertest.h"
class IndexedDBLayoutTest : public InProcessBrowserLayoutTest {
diff --git a/content/browser/media_browsertest.cc b/content/browser/media_browsertest.cc
index 10f0fc4..f39fd49 100644
--- a/content/browser/media_browsertest.cc
+++ b/content/browser/media_browsertest.cc
@@ -7,21 +7,18 @@
#include "base/stringprintf.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_tabstrip.h"
-#include "chrome/test/base/ui_test_utils.h"
#include "content/public/test/browser_test_utils.h"
+#include "content/shell/shell.h"
#include "content/test/layout_browsertest.h"
+#include "content/test/content_browser_test_utils.h"
#include "googleurl/src/gurl.h"
-class MediaTest : public InProcessBrowserTest {
+class MediaTest : public content::ContentBrowserTest {
protected:
GURL GetTestURL(const char* tag, const char* media_file) {
- FilePath test_file_path = ui_test_utils::GetTestFilePath(
- FilePath(FILE_PATH_LITERAL("media")),
- FilePath(FILE_PATH_LITERAL("player.html")));
+ FilePath test_file_path = content::GetTestFilePath("media", "player.html");
std::string query = base::StringPrintf("%s=%s", tag, media_file);
- return ui_test_utils::GetFileUrlWithQuery(test_file_path, query);
+ return content::GetFileUrlWithQuery(test_file_path, query);
}
void PlayMedia(const char* tag, const char* media_file) {
@@ -31,12 +28,11 @@ class MediaTest : public InProcessBrowserTest {
const string16 kPlaying = ASCIIToUTF16("PLAYING");
const string16 kFailed = ASCIIToUTF16("FAILED");
const string16 kError = ASCIIToUTF16("ERROR");
- content::TitleWatcher title_watcher(
- chrome::GetActiveWebContents(browser()), kPlaying);
+ content::TitleWatcher title_watcher(shell()->web_contents(), kPlaying);
title_watcher.AlsoWaitForTitle(kFailed);
title_watcher.AlsoWaitForTitle(kError);
- ui_test_utils::NavigateToURL(browser(), player_gurl);
+ content::NavigateToURL(shell(), player_gurl);
string16 final_title = title_watcher.WaitAndGetTitle();
EXPECT_EQ(kPlaying, final_title);
diff --git a/content/browser/plugin_browsertest.cc b/content/browser/plugin_browsertest.cc
index 85d395b..b089526 100644
--- a/content/browser/plugin_browsertest.cc
+++ b/content/browser/plugin_browsertest.cc
@@ -39,13 +39,10 @@ class PluginTest : public ContentBrowserTest {
// Some NPAPI tests schedule garbage collection to force object tear-down.
command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose_gc");
+#if defined(OS_WIN)
const testing::TestInfo* const test_info =
testing::UnitTest::GetInstance()->current_test_info();
- if (strcmp(test_info->name(), "PrivateEnabled") == 0) {
- command_line->AppendSwitch(switches::kOffTheRecord);
- }
-#if defined(OS_WIN)
- else if (strcmp(test_info->name(), "MediaPlayerNew") == 0) {
+ if (strcmp(test_info->name(), "MediaPlayerNew") == 0) {
// The installer adds our process names to the registry key below. Since
// the installer might not have run on this machine, add it manually.
base::win::RegKey regkey;
@@ -78,12 +75,12 @@ class PluginTest : public ContentBrowserTest {
BrowserThread::IO, FROM_HERE, base::Bind(&SetUrlRequestMock, path));
}
- void LoadAndWait(const GURL& url) {
+ static void LoadAndWaitInWindow(Shell* window, const GURL& url) {
string16 expected_title(ASCIIToUTF16("OK"));
- TitleWatcher title_watcher(shell()->web_contents(), expected_title);
+ TitleWatcher title_watcher(window->web_contents(), expected_title);
title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
title_watcher.AlsoWaitForTitle(ASCIIToUTF16("plugin_not_found"));
- NavigateToURL(shell(), url);
+ NavigateToURL(window, url);
string16 title = title_watcher.WaitAndGetTitle();
if (title == ASCIIToUTF16("plugin_not_found")) {
const testing::TestInfo* const test_info =
@@ -95,6 +92,10 @@ class PluginTest : public ContentBrowserTest {
}
}
+ void LoadAndWait(const GURL& url) {
+ LoadAndWaitInWindow(shell(), url);
+ }
+
GURL GetURL(const char* filename) {
return GetTestUrl("npapi", filename);
}
@@ -333,7 +334,7 @@ IN_PROC_BROWSER_TEST_F(PluginTest, PluginThreadAsyncCall) {
IN_PROC_BROWSER_TEST_F(PluginTest, PrivateEnabled) {
GURL url = GetURL("private.html");
url = GURL(url.spec() + "?private");
- LoadAndWait(url);
+ LoadAndWaitInWindow(CreateOffTheRecordBrowser(), url);
}
#if defined(OS_WIN) || defined(OS_MACOSX)
diff --git a/content/browser/worker_host/test/worker_browsertest.cc b/content/browser/worker_host/test/worker_browsertest.cc
index b04a9a3..55103c5 100644
--- a/content/browser/worker_host/test/worker_browsertest.cc
+++ b/content/browser/worker_host/test/worker_browsertest.cc
@@ -11,14 +11,16 @@
#include "base/sys_info.h"
#include "base/test/test_timeouts.h"
#include "base/utf_string_conversions.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_tabstrip.h"
-#include "chrome/test/base/ui_test_utils.h"
#include "content/browser/worker_host/worker_process_host.h"
#include "content/browser/worker_host/worker_service_impl.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_paths.h"
#include "content/public/test/browser_test_utils.h"
+#include "content/public/test/test_utils.h"
+#include "content/shell/shell.h"
+#include "content/shell/shell_content_browser_client.h"
+#include "content/shell/shell_resource_dispatcher_host_delegate.h"
+#include "content/test/content_browser_test_utils.h"
#include "content/test/layout_browsertest.h"
#include "googleurl/src/gurl.h"
@@ -272,31 +274,29 @@ IN_PROC_BROWSER_TEST_F(WorkerWebSocketHttpLayoutTest, DISABLED_Tests) {
RunHttpLayoutTest(kLayoutTestFiles[i]);
}
-class WorkerTest : public InProcessBrowserTest {
+class WorkerTest : public content::ContentBrowserTest {
public:
WorkerTest() {}
GURL GetTestURL(const std::string& test_case, const std::string& query) {
- FilePath test_file_path = ui_test_utils::GetTestFilePath(
- FilePath(FILE_PATH_LITERAL("workers")),
- FilePath().AppendASCII(test_case));
- return ui_test_utils::GetFileUrlWithQuery(test_file_path, query);
+ FilePath test_file_path = content::GetTestFilePath(
+ "workers", test_case.c_str());
+ return content::GetFileUrlWithQuery(test_file_path, query);
}
- void RunTest(Browser* browser,
+ void RunTest(content::Shell* window,
const std::string& test_case,
const std::string& query) {
GURL url = GetTestURL(test_case, query);
const string16 expected_title = ASCIIToUTF16("OK");
- content::TitleWatcher title_watcher(
- chrome::GetActiveWebContents(browser), expected_title);
- ui_test_utils::NavigateToURL(browser, url);
+ content::TitleWatcher title_watcher(window->web_contents(), expected_title);
+ content::NavigateToURL(window, url);
string16 final_title = title_watcher.WaitAndGetTitle();
EXPECT_EQ(expected_title, final_title);
}
void RunTest(const std::string& test_case, const std::string& query) {
- RunTest(browser(), test_case, query);
+ RunTest(shell(), test_case, query);
}
static void CountWorkerProcesses(int *cur_process_count) {
@@ -313,7 +313,9 @@ class WorkerTest : public InProcessBrowserTest {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&CountWorkerProcesses, &cur_process_count));
- ui_test_utils::RunMessageLoop();
+
+ base::RunLoop run_loop;
+ content::RunThisRunLoop(&run_loop);
if (cur_process_count == count)
return true;
@@ -325,6 +327,23 @@ class WorkerTest : public InProcessBrowserTest {
EXPECT_EQ(cur_process_count, count);
return false;
}
+
+ static void QuitUIMessageLoop(base::Callback<void()> callback) {
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback);
+ }
+
+ void NavigateAndWaitForAuth(const GURL& url) {
+ content::ShellContentBrowserClient* browser_client =
+ static_cast<content::ShellContentBrowserClient*>(
+ content::GetContentClient()->browser());
+ scoped_refptr<content::MessageLoopRunner> runner =
+ new content::MessageLoopRunner();
+ browser_client->resource_dispatcher_host_delegate()->
+ set_login_request_callback(
+ base::Bind(&QuitUIMessageLoop, runner->QuitClosure()));
+ shell()->LoadURL(url);
+ runner->Run();
+ }
};
IN_PROC_BROWSER_TEST_F(WorkerTest, SingleWorker) {
@@ -351,7 +370,7 @@ IN_PROC_BROWSER_TEST_F(WorkerTest, IncognitoSharedWorkers) {
RunTest("incognito_worker.html", "");
// Incognito worker should not share with non-incognito
- RunTest(CreateIncognitoBrowser(), "incognito_worker.html", "");
+ RunTest(CreateOffTheRecordBrowser(), "incognito_worker.html", "");
}
// Make sure that auth dialog is displayed from worker context.
@@ -360,8 +379,7 @@ IN_PROC_BROWSER_TEST_F(WorkerTest, WorkerHttpAuth) {
ASSERT_TRUE(test_server()->Start());
GURL url = test_server()->GetURL("files/workers/worker_auth.html");
- ui_test_utils::NavigateToURLWithDisposition(
- browser(), url, CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_AUTH);
+ NavigateAndWaitForAuth(url);
}
// Make sure that auth dialog is displayed from shared worker context.
@@ -369,8 +387,7 @@ IN_PROC_BROWSER_TEST_F(WorkerTest, WorkerHttpAuth) {
IN_PROC_BROWSER_TEST_F(WorkerTest, SharedWorkerHttpAuth) {
ASSERT_TRUE(test_server()->Start());
GURL url = test_server()->GetURL("files/workers/shared_worker_auth.html");
- ui_test_utils::NavigateToURLWithDisposition(
- browser(), url, CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_AUTH);
+ NavigateAndWaitForAuth(url);
}
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
@@ -384,7 +401,7 @@ IN_PROC_BROWSER_TEST_F(WorkerTest, LimitPerPage) {
std::string query = StringPrintf("?count=%d", max_workers_per_tab + 1);
GURL url = GetTestURL("many_shared_workers.html", query);
- ui_test_utils::NavigateToURL(browser(), url);
+ content::NavigateToURL(shell(), url);
ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab));
}
@@ -406,26 +423,22 @@ IN_PROC_BROWSER_TEST_F(WorkerTest, LimitTotal) {
std::string query = StringPrintf("?count=%d", max_workers_per_tab);
GURL url = GetTestURL("many_shared_workers.html", query);
- ui_test_utils::NavigateToURL(
- browser(), GURL(url.spec() + StringPrintf("&client_id=0")));
+ content::NavigateToURL(
+ shell(), GURL(url.spec() + StringPrintf("&client_id=0")));
// Adding 1 so that we cause some workers to be queued.
int tab_count = (total_workers / max_workers_per_tab) + 1;
for (int i = 1; i < tab_count; ++i) {
- ui_test_utils::NavigateToURLWithDisposition(
- browser(), GURL(url.spec() + StringPrintf("&client_id=%d", i)),
- NEW_FOREGROUND_TAB,
- ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
+ content::NavigateToURL(
+ CreateBrowser(), GURL(url.spec() + StringPrintf("&client_id=%d", i)));
}
// Check that we didn't create more than the max number of workers.
ASSERT_TRUE(WaitForWorkerProcessCount(total_workers));
// Now close a page and check that the queued workers were started.
- const FilePath kGoogleDir(FILE_PATH_LITERAL("google"));
- const FilePath kGoogleFile(FILE_PATH_LITERAL("google.html"));
- url = GURL(ui_test_utils::GetTestUrl(kGoogleDir, kGoogleFile));
- ui_test_utils::NavigateToURL(browser(), url);
+ url = GURL(content::GetTestUrl("google", "google.html"));
+ content::NavigateToURL(shell(), url);
ASSERT_TRUE(WaitForWorkerProcessCount(total_workers));
}
@@ -455,23 +468,19 @@ IN_PROC_BROWSER_TEST_F(WorkerTest, DISABLED_MultipleTabsQueuedSharedWorker) {
int max_workers_per_tab = WorkerServiceImpl::kMaxWorkersPerTabWhenSeparate;
std::string query = StringPrintf("?count=%d", max_workers_per_tab + 1);
GURL url = GetTestURL("many_shared_workers.html", query);
- ui_test_utils::NavigateToURL(browser(), url);
+ content::NavigateToURL(shell(), url);
ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab));
// Create same set of workers in new tab (leaves one worker queued from this
// tab).
url = GetTestURL("many_shared_workers.html", query);
- ui_test_utils::NavigateToURLWithDisposition(
- browser(), url, NEW_FOREGROUND_TAB,
- ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
+ content::NavigateToURL(CreateBrowser(), url);
ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab));
// Now shutdown one of the shared workers - this will fire both queued
// workers, but only one instance should be started.
url = GetTestURL("shutdown_shared_worker.html", "?id=0");
- ui_test_utils::NavigateToURLWithDisposition(
- browser(), url, NEW_FOREGROUND_TAB,
- ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
+ content::NavigateToURL(CreateBrowser(), url);
ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab));
}
@@ -482,7 +491,7 @@ IN_PROC_BROWSER_TEST_F(WorkerTest, DISABLED_QueuedSharedWorkerStartedFromOtherTa
int max_workers_per_tab = WorkerServiceImpl::kMaxWorkersPerTabWhenSeparate;
std::string query = StringPrintf("?count=%d", max_workers_per_tab + 1);
GURL url = GetTestURL("many_shared_workers.html", query);
- ui_test_utils::NavigateToURL(browser(), url);
+ content::NavigateToURL(shell(), url);
ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab));
// First window has hit its limit. Now launch second window which creates
@@ -490,9 +499,7 @@ IN_PROC_BROWSER_TEST_F(WorkerTest, DISABLED_QueuedSharedWorkerStartedFromOtherTa
// connected to the first window too.
query = StringPrintf("?id=%d", max_workers_per_tab);
url = GetTestURL("single_shared_worker.html", query);
- ui_test_utils::NavigateToURLWithDisposition(
- browser(), url, NEW_FOREGROUND_TAB,
- ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
+ content::NavigateToURL(CreateBrowser(), url);
ASSERT_TRUE(WaitForWorkerProcessCount(max_workers_per_tab + 1));
}
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index 539fe72..8ec64a4 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -542,7 +542,12 @@
'HAS_OUT_OF_PROC_TEST_RUNNER',
],
'sources': [
+ 'browser/appcache/appcache_browsertest.cc',
+ 'browser/audio_browsertest.cc',
+ 'browser/in_process_webkit/indexed_db_layout_browsertest.cc',
+ 'browser/media_browsertest.cc',
'browser/plugin_browsertest.cc',
+ 'browser/worker_host/test/worker_browsertest.cc',
'test/content_browser_test.h',
'test/content_browser_test.cc',
'test/content_browser_test_utils.cc',
@@ -550,6 +555,10 @@
'test/content_browser_test_utils_mac.mm',
'test/content_browser_test_test.cc',
'test/content_test_launcher.cc',
+ 'test/layout_browsertest.cc',
+ 'test/layout_browsertest.h',
+ 'test/layout_test_http_server.cc',
+ 'test/layout_test_http_server.h',
],
'conditions': [
['OS=="win"', {
diff --git a/content/public/test/browser_test_utils.h b/content/public/test/browser_test_utils.h
index 58e5e9c..f9eb108a 100644
--- a/content/public/test/browser_test_utils.h
+++ b/content/public/test/browser_test_utils.h
@@ -46,6 +46,9 @@ class MessageLoopRunner;
class RenderViewHost;
class WebContents;
+// Generate a URL for a file path including a query string.
+GURL GetFileUrlWithQuery(const FilePath& path, const std::string& query_string);
+
// Simulates clicking at the center of the given tab asynchronously.
void SimulateMouseClick(WebContents* web_contents);
diff --git a/content/shell/shell_browser_context.cc b/content/shell/shell_browser_context.cc
index bb39e8c..dbde11a 100644
--- a/content/shell/shell_browser_context.cc
+++ b/content/shell/shell_browser_context.cc
@@ -27,7 +27,8 @@
namespace content {
-ShellBrowserContext::ShellBrowserContext() {
+ShellBrowserContext::ShellBrowserContext(bool off_the_record)
+ : off_the_record_(off_the_record) {
InitWhileIOAllowed();
}
@@ -75,7 +76,7 @@ FilePath ShellBrowserContext::GetPath() {
}
bool ShellBrowserContext::IsOffTheRecord() const {
- return CommandLine::ForCurrentProcess()->HasSwitch(switches::kOffTheRecord);
+ return off_the_record_;
}
DownloadManagerDelegate* ShellBrowserContext::GetDownloadManagerDelegate() {
diff --git a/content/shell/shell_browser_context.h b/content/shell/shell_browser_context.h
index cb1ddef..52814c2 100644
--- a/content/shell/shell_browser_context.h
+++ b/content/shell/shell_browser_context.h
@@ -21,7 +21,7 @@ class ShellDownloadManagerDelegate;
class ShellBrowserContext : public BrowserContext {
public:
- ShellBrowserContext();
+ explicit ShellBrowserContext(bool off_the_record);
virtual ~ShellBrowserContext();
// BrowserContext implementation.
@@ -45,6 +45,7 @@ class ShellBrowserContext : public BrowserContext {
// allowed on the current thread.
void InitWhileIOAllowed();
+ bool off_the_record_;
ScopedTempDir testing_path_;
FilePath path_;
scoped_ptr<ResourceContext> resource_context_;
diff --git a/content/shell/shell_browser_main_parts.cc b/content/shell/shell_browser_main_parts.cc
index 87bf75b..0447f23 100644
--- a/content/shell/shell_browser_main_parts.cc
+++ b/content/shell/shell_browser_main_parts.cc
@@ -65,7 +65,8 @@ void ShellBrowserMainParts::PreEarlyInitialization() {
}
void ShellBrowserMainParts::PreMainMessageLoopRun() {
- browser_context_.reset(new ShellBrowserContext);
+ browser_context_.reset(new ShellBrowserContext(false));
+ off_the_record_browser_context_.reset(new ShellBrowserContext(true));
Shell::PlatformInitialize();
net::NetModule::SetResourceProvider(Shell::PlatformResourceProvider);
@@ -107,6 +108,7 @@ void ShellBrowserMainParts::PostMainMessageLoopRun() {
if (devtools_delegate_)
devtools_delegate_->Stop();
browser_context_.reset();
+ off_the_record_browser_context_.reset();
}
} // namespace
diff --git a/content/shell/shell_browser_main_parts.h b/content/shell/shell_browser_main_parts.h
index 7c6abf1..f6c1f4e 100644
--- a/content/shell/shell_browser_main_parts.h
+++ b/content/shell/shell_browser_main_parts.h
@@ -35,9 +35,13 @@ class ShellBrowserMainParts : public BrowserMainParts {
ShellDevToolsDelegate* devtools_delegate() { return devtools_delegate_; }
ShellBrowserContext* browser_context() { return browser_context_.get(); }
+ ShellBrowserContext* off_the_record_browser_context() {
+ return off_the_record_browser_context_.get();
+ }
private:
scoped_ptr<ShellBrowserContext> browser_context_;
+ scoped_ptr<ShellBrowserContext> off_the_record_browser_context_;
// For running content_browsertests.
const MainFunctionParams& parameters_;
diff --git a/content/shell/shell_content_browser_client.cc b/content/shell/shell_content_browser_client.cc
index ddeb5be..23b3247 100644
--- a/content/shell/shell_content_browser_client.cc
+++ b/content/shell/shell_content_browser_client.cc
@@ -88,6 +88,11 @@ ShellBrowserContext* ShellContentBrowserClient::browser_context() {
return shell_browser_main_parts_->browser_context();
}
+ShellBrowserContext*
+ ShellContentBrowserClient::off_the_record_browser_context() {
+ return shell_browser_main_parts_->off_the_record_browser_context();
+}
+
AccessTokenStore* ShellContentBrowserClient::CreateAccessTokenStore() {
return new ShellAccessTokenStore(browser_context()->GetRequestContext());
}
diff --git a/content/shell/shell_content_browser_client.h b/content/shell/shell_content_browser_client.h
index ac42a70..e3ffe85 100644
--- a/content/shell/shell_content_browser_client.h
+++ b/content/shell/shell_content_browser_client.h
@@ -40,6 +40,10 @@ class ShellContentBrowserClient : public ContentBrowserClient {
#endif
ShellBrowserContext* browser_context();
+ ShellBrowserContext* off_the_record_browser_context();
+ ShellResourceDispatcherHostDelegate* resource_dispatcher_host_delegate() {
+ return resource_dispatcher_host_delegate_.get();
+ }
private:
scoped_ptr<ShellResourceDispatcherHostDelegate>
diff --git a/content/shell/shell_resource_dispatcher_host_delegate.cc b/content/shell/shell_resource_dispatcher_host_delegate.cc
index 20bab2c..a7b8984 100644
--- a/content/shell/shell_resource_dispatcher_host_delegate.cc
+++ b/content/shell/shell_resource_dispatcher_host_delegate.cc
@@ -24,6 +24,12 @@ bool ShellResourceDispatcherHostDelegate::AcceptAuthRequest(
ResourceDispatcherHostLoginDelegate*
ShellResourceDispatcherHostDelegate::CreateLoginDelegate(
net::AuthChallengeInfo* auth_info, net::URLRequest* request) {
+ if (!login_request_callback_.is_null()) {
+ login_request_callback_.Run();
+ login_request_callback_.Reset();
+ return NULL;
+ }
+
#if !defined(OS_MACOSX)
// TODO: implement ShellLoginDialog for other platforms, drop this #if
return NULL;
diff --git a/content/shell/shell_resource_dispatcher_host_delegate.h b/content/shell/shell_resource_dispatcher_host_delegate.h
index 7b76ded..ff78e48 100644
--- a/content/shell/shell_resource_dispatcher_host_delegate.h
+++ b/content/shell/shell_resource_dispatcher_host_delegate.h
@@ -5,6 +5,7 @@
#ifndef CONTENT_SHELL_SHELL_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
#define CONTENT_SHELL_SHELL_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
+#include "base/callback.h"
#include "base/compiler_specific.h"
#include "content/public/browser/resource_dispatcher_host_delegate.h"
@@ -22,7 +23,15 @@ class ShellResourceDispatcherHostDelegate
virtual ResourceDispatcherHostLoginDelegate* CreateLoginDelegate(
net::AuthChallengeInfo* auth_info, net::URLRequest* request) OVERRIDE;
+ // Used for content_browsertests.
+ void set_login_request_callback(
+ base::Callback<void()> login_request_callback) {
+ login_request_callback_ = login_request_callback;
+ }
+
private:
+ base::Callback<void()> login_request_callback_;
+
DISALLOW_COPY_AND_ASSIGN(ShellResourceDispatcherHostDelegate);
};
diff --git a/content/shell/shell_switches.cc b/content/shell/shell_switches.cc
index 0bd7175..e3cffb3 100644
--- a/content/shell/shell_switches.cc
+++ b/content/shell/shell_switches.cc
@@ -15,6 +15,4 @@ const char kContentBrowserTest[] = "browser-test";
// Request pages to be dumped as text once they finished loading.
const char kDumpRenderTree[] = "dump-render-tree";
-const char kOffTheRecord[] = "off-the-record";
-
} // namespace switches
diff --git a/content/shell/shell_switches.h b/content/shell/shell_switches.h
index 0c5810d..342cedd 100644
--- a/content/shell/shell_switches.h
+++ b/content/shell/shell_switches.h
@@ -12,7 +12,6 @@ namespace switches {
extern const char kCheckLayoutTestSysDeps[];
extern const char kContentBrowserTest[];
extern const char kDumpRenderTree[];
-extern const char kOffTheRecord[];
} // namespace switches
diff --git a/content/test/browser_test_base.cc b/content/test/browser_test_base.cc
index a6841e9..5e805b5 100644
--- a/content/test/browser_test_base.cc
+++ b/content/test/browser_test_base.cc
@@ -33,6 +33,8 @@ void BrowserTestBase::SetUp() {
// The tests assume that file:// URIs can freely access other file:// URIs.
command_line->AppendSwitch(switches::kAllowFileAccessFromFiles);
+ command_line->AppendSwitch(switches::kDomAutomationController);
+
content::MainFunctionParams params(*command_line);
params.ui_task =
new base::Closure(
@@ -49,3 +51,11 @@ void BrowserTestBase::TearDown() {
void BrowserTestBase::ProxyRunTestOnMainThreadLoop() {
RunTestOnMainThreadLoop();
}
+
+void BrowserTestBase::CreateTestServer(const char* test_server_base) {
+ CHECK(!test_server_.get());
+ test_server_.reset(new net::TestServer(
+ net::TestServer::TYPE_HTTP,
+ net::TestServer::kLocalhost,
+ FilePath().AppendASCII(test_server_base)));
+}
diff --git a/content/test/browser_test_base.h b/content/test/browser_test_base.h
index b9b24ae..300d7bf 100644
--- a/content/test/browser_test_base.h
+++ b/content/test/browser_test_base.h
@@ -7,6 +7,7 @@
#include "base/compiler_specific.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "net/test/test_server.h"
class CommandLine;
@@ -56,8 +57,23 @@ class BrowserTestBase : public testing::Test {
// (RunTestOnMainThread), quits the browsers and returns.
virtual void RunTestOnMainThreadLoop() = 0;
+ // Returns the testing server. Guaranteed to be non-NULL.
+ const net::TestServer* test_server() const { return test_server_.get(); }
+ net::TestServer* test_server() { return test_server_.get(); }
+
+ // This function is meant only for classes that directly derive from this
+ // class to construct the test server in their constructor. They might need to
+ // call this after setting up the paths. Actual test cases should never call
+ // this.
+ // |test_server_base| is the path, relative to src, to give to the test HTTP
+ // server.
+ void CreateTestServer(const char* test_server_base);
+
private:
void ProxyRunTestOnMainThreadLoop();
+
+ // Testing server, started on demand.
+ scoped_ptr<net::TestServer> test_server_;
};
#endif // CONTENT_TEST_BROWSER_TEST_BASE_H_
diff --git a/content/test/browser_test_utils.cc b/content/test/browser_test_utils.cc
index 74f152b..6b194f8 100644
--- a/content/test/browser_test_utils.cc
+++ b/content/test/browser_test_utils.cc
@@ -12,6 +12,7 @@
#include "base/string_number_conversions.h"
#include "base/test/test_timeouts.h"
#include "base/utf_string_conversions.h"
+#include "net/base/net_util.h"
#include "content/public/browser/dom_operation_notification_details.h"
#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_view_host.h"
@@ -146,6 +147,18 @@ void BuildSimpleWebKeyEvent(WebKit::WebInputEvent::Type type,
} // namespace
+
+GURL GetFileUrlWithQuery(const FilePath& path,
+ const std::string& query_string) {
+ GURL url = net::FilePathToFileURL(path);
+ if (!query_string.empty()) {
+ GURL::Replacements replacements;
+ replacements.SetQueryStr(query_string);
+ return url.ReplaceComponents(replacements);
+ }
+ return url;
+}
+
void SimulateMouseClick(WebContents* web_contents) {
int x = web_contents->GetView()->GetContainerSize().width() / 2;
int y = web_contents->GetView()->GetContainerSize().height() / 2;
diff --git a/content/test/content_browser_test.cc b/content/test/content_browser_test.cc
index ff2bfd2..93fa7cbc 100644
--- a/content/test/content_browser_test.cc
+++ b/content/test/content_browser_test.cc
@@ -12,7 +12,10 @@
#include "base/path_service.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_switches.h"
+#include "content/public/common/url_constants.h"
#include "content/shell/shell.h"
+#include "content/shell/shell_browser_context.h"
+#include "content/shell/shell_content_browser_client.h"
#include "content/shell/shell_main_delegate.h"
#include "content/shell/shell_switches.h"
#include "content/test/test_content_client.h"
@@ -33,6 +36,7 @@ ContentBrowserTest::ContentBrowserTest() {
FILE_PATH_LITERAL("Content Shell.app/Contents/MacOS/Content Shell"));
CHECK(PathService::Override(base::FILE_EXE, content_shell_path));
#endif
+ CreateTestServer("content/test/data");
}
ContentBrowserTest::~ContentBrowserTest() {
@@ -117,4 +121,26 @@ void ContentBrowserTest::RunTestOnMainThreadLoop() {
}
}
+Shell* ContentBrowserTest::CreateBrowser() {
+ ShellContentBrowserClient* browser_client =
+ static_cast<ShellContentBrowserClient*>(GetContentClient()->browser());
+ return Shell::CreateNewWindow(
+ browser_client->browser_context(),
+ GURL(chrome::kAboutBlankURL),
+ NULL,
+ MSG_ROUTING_NONE,
+ NULL);
+}
+
+Shell* ContentBrowserTest::CreateOffTheRecordBrowser() {
+ ShellContentBrowserClient* browser_client =
+ static_cast<ShellContentBrowserClient*>(GetContentClient()->browser());
+ return Shell::CreateNewWindow(
+ browser_client->off_the_record_browser_context(),
+ GURL(chrome::kAboutBlankURL),
+ NULL,
+ MSG_ROUTING_NONE,
+ NULL);
+}
+
} // namespace content
diff --git a/content/test/content_browser_test.h b/content/test/content_browser_test.h
index e0acdf8..c9b6da2 100644
--- a/content/test/content_browser_test.h
+++ b/content/test/content_browser_test.h
@@ -9,6 +9,8 @@
#include "content/public/test/browser_test.h"
#include "content/test/browser_test_base.h"
+class GURL;
+
namespace content {
class Shell;
class ShellMainDelegate;
@@ -26,11 +28,17 @@ class ContentBrowserTest : public BrowserTestBase {
virtual void RunTestOnMainThreadLoop() OVERRIDE;
protected:
+ // Creates a new window and loads about:blank.
+ Shell* CreateBrowser();
+
+ // Creates an off-the-record window and loads about:blank.
+ Shell* CreateOffTheRecordBrowser();
+
// Returns the window for the test.
Shell* shell() const { return shell_; }
private:
- scoped_ptr<content::ShellMainDelegate> shell_main_delegate_;
+ scoped_ptr<content::ShellMainDelegate> shell_main_delegate_;
Shell* shell_;
};
diff --git a/content/test/layout_browsertest.cc b/content/test/layout_browsertest.cc
index d76956a..e6607f7 100644
--- a/content/test/layout_browsertest.cc
+++ b/content/test/layout_browsertest.cc
@@ -12,14 +12,12 @@
#include "base/stringprintf.h"
#include "base/string_util.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/layout_test_http_server.h"
-#include "chrome/test/base/ui_test_utils.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/common/content_paths.h"
#include "content/public/test/browser_test_utils.h"
+#include "content/shell/shell.h"
+#include "content/test/content_browser_test_utils.h"
+#include "content/test/layout_test_http_server.h"
#include "net/base/net_util.h"
#if defined(OS_WIN)
@@ -59,9 +57,9 @@ bool ReadExpectedResult(const FilePath& result_dir_path,
expected_result_path, expected_result_value);
}
-void ScrapeResultFromBrowser(Browser* browser, std::string* actual_text) {
+void ScrapeResultFromBrowser(content::Shell* window, std::string* actual_text) {
ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString(
- chrome::GetActiveWebContents(browser)->GetRenderViewHost(),
+ window->web_contents()->GetRenderViewHost(),
L"",
L"window.domAutomationController.send(document.body.innerText);",
actual_text));
@@ -186,15 +184,14 @@ void InProcessBrowserLayoutTest::RunLayoutTestInternal(
const std::string& test_case_file_name, const GURL& url) {
LOG(INFO) << "Navigating to URL " << url << " and blocking.";
const string16 expected_title = ASCIIToUTF16("done");
- content::TitleWatcher title_watcher(
- chrome::GetActiveWebContents(browser()), expected_title);
- ui_test_utils::NavigateToURL(browser(), url);
+ content::TitleWatcher title_watcher(shell()->web_contents(), expected_title);
+ content::NavigateToURL(shell(), url);
LOG(INFO) << "Navigation completed, now waiting for title.";
string16 final_title = title_watcher.WaitAndGetTitle();
EXPECT_EQ(expected_title, final_title);
std::string actual_text;
- ScrapeResultFromBrowser(browser(), &actual_text);
+ ScrapeResultFromBrowser(shell(), &actual_text);
ReplaceSubstringsAfterOffset(&actual_text, 0, "\r", "");
TrimString(actual_text, "\n", &actual_text);
diff --git a/content/test/layout_browsertest.h b/content/test/layout_browsertest.h
index 5f2ed83..9f9cec9b 100644
--- a/content/test/layout_browsertest.h
+++ b/content/test/layout_browsertest.h
@@ -4,11 +4,12 @@
#include "base/file_path.h"
#include "base/scoped_temp_dir.h"
-#include "chrome/test/base/in_process_browser_test.h"
+#include "content/test/content_browser_test.h"
+class GURL;
class LayoutTestHttpServer;
-class InProcessBrowserLayoutTest : public InProcessBrowserTest {
+class InProcessBrowserLayoutTest : public content::ContentBrowserTest {
public:
explicit InProcessBrowserLayoutTest(const FilePath& test_parent_dir,
const FilePath& test_case_dir);
diff --git a/chrome/test/base/layout_test_http_server.cc b/content/test/layout_test_http_server.cc
index 11c52f1..783c596 100644
--- a/chrome/test/base/layout_test_http_server.cc
+++ b/content/test/layout_test_http_server.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 "chrome/test/base/layout_test_http_server.h"
+#include "content/test/layout_test_http_server.h"
#include "base/command_line.h"
#include "base/logging.h"
diff --git a/chrome/test/base/layout_test_http_server.h b/content/test/layout_test_http_server.h
index a094a54..5b76685 100644
--- a/chrome/test/base/layout_test_http_server.h
+++ b/content/test/layout_test_http_server.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 CHROME_TEST_BASE_LAYOUT_TEST_HTTP_SERVER_H_
-#define CHROME_TEST_BASE_LAYOUT_TEST_HTTP_SERVER_H_
+#ifndef CONTENT_TEST_LAYOUT_TEST_HTTP_SERVER_H_
+#define CONTENT_TEST_LAYOUT_TEST_HTTP_SERVER_H_
#include "base/compiler_specific.h"
#include "base/file_path.h"
@@ -50,4 +50,4 @@ class LayoutTestHttpServer {
DISALLOW_COPY_AND_ASSIGN(LayoutTestHttpServer);
};
-#endif // CHROME_TEST_BASE_LAYOUT_TEST_HTTP_SERVER_H_
+#endif // CONTENT_TEST_LAYOUT_TEST_HTTP_SERVER_H_
diff --git a/ui/views/examples/content_client/examples_browser_main_parts.cc b/ui/views/examples/content_client/examples_browser_main_parts.cc
index 990e4ed..6103dc2 100644
--- a/ui/views/examples/content_client/examples_browser_main_parts.cc
+++ b/ui/views/examples/content_client/examples_browser_main_parts.cc
@@ -51,7 +51,7 @@ ExamplesBrowserMainParts::~ExamplesBrowserMainParts() {
}
void ExamplesBrowserMainParts::PreMainMessageLoopRun() {
- browser_context_.reset(new content::ShellBrowserContext);
+ browser_context_.reset(new content::ShellBrowserContext(false));
#if defined(USE_AURA)
aura::Env::GetInstance()->SetDisplayManager(new aura::SingleDisplayManager);