summaryrefslogtreecommitdiffstats
path: root/content/shell
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-28 16:20:39 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-28 16:20:39 +0000
commit19f8cb47d136c3e9b321db629a050a0464ff8699 (patch)
treeb69ddbb1ca2aee34157a1aa4b52a9e72de664976 /content/shell
parentadec2b3353ec8381d5384bec5e0501ded140d377 (diff)
downloadchromium_src-19f8cb47d136c3e9b321db629a050a0464ff8699.zip
chromium_src-19f8cb47d136c3e9b321db629a050a0464ff8699.tar.gz
chromium_src-19f8cb47d136c3e9b321db629a050a0464ff8699.tar.bz2
[content shell] Don't try to reuse a webcontents for multiple tests
Since we don't immediatetely delete renderers, the renderer process will be reused for the new render view, so the impact of creating a new web contents is rather small BUG=111316 TEST=content_browsertests --gtest_filter=*LayoutTest.* doesn't break Review URL: https://chromiumcodereview.appspot.com/10985077 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159271 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/shell')
-rw-r--r--content/shell/webkit_test_runner_host.cc48
-rw-r--r--content/shell/webkit_test_runner_host.h2
2 files changed, 15 insertions, 35 deletions
diff --git a/content/shell/webkit_test_runner_host.cc b/content/shell/webkit_test_runner_host.cc
index f909f4c..88b2f12 100644
--- a/content/shell/webkit_test_runner_host.cc
+++ b/content/shell/webkit_test_runner_host.cc
@@ -123,17 +123,6 @@ WebKitTestController::WebKitTestController() {
CHECK(!instance_);
instance_ = this;
printer_.reset(new WebKitTestResultPrinter(&std::cout, &std::cerr));
-
- content::ShellBrowserContext* browser_context =
- static_cast<content::ShellContentBrowserClient*>(
- content::GetContentClient()->browser())->browser_context();
- main_window_ = content::Shell::CreateNewWindow(
- browser_context,
- GURL("about:blank"),
- NULL,
- MSG_ROUTING_NONE,
- NULL);
- Observe(main_window_->web_contents());
ResetAfterLayoutTest();
}
@@ -150,13 +139,20 @@ bool WebKitTestController::PrepareForLayoutTest(
bool enable_pixel_dumping,
const std::string& expected_pixel_hash) {
DCHECK(CalledOnValidThread());
- if (!main_window_)
- return false;
enable_pixel_dumping_ = enable_pixel_dumping;
expected_pixel_hash_ = expected_pixel_hash;
printer_->reset();
printer_->PrintTextHeader();
- main_window_->LoadURL(test_url);
+ content::ShellBrowserContext* browser_context =
+ static_cast<content::ShellContentBrowserClient*>(
+ content::GetContentClient()->browser())->browser_context();
+ main_window_ = content::Shell::CreateNewWindow(
+ browser_context,
+ test_url,
+ NULL,
+ MSG_ROUTING_NONE,
+ NULL);
+ Observe(main_window_->web_contents());
return true;
}
@@ -164,7 +160,6 @@ bool WebKitTestController::ResetAfterLayoutTest() {
DCHECK(CalledOnValidThread());
printer_->PrintTextFooter();
printer_->PrintImageFooter();
- pumping_messages_ = false;
enable_pixel_dumping_ = false;
expected_pixel_hash_.clear();
captured_dump_ = false;
@@ -174,20 +169,12 @@ bool WebKitTestController::ResetAfterLayoutTest() {
should_stay_on_page_after_handling_before_unload_ = false;
wait_until_done_ = false;
watchdog_.Cancel();
- if (!main_window_)
- return false;
- if (main_window_->web_contents()->GetController().GetEntryCount() > 0) {
- // Reset the WebContents for the next test.
- // TODO(jochen): Reset it more thoroughly.
- main_window_->web_contents()->GetController().GoToIndex(0);
+ if (main_window_) {
+ Observe(NULL);
+ main_window_ = NULL;
}
- renderer_crashed_ = false;
- // Wait for the main_window_ to finish loading.
- pumping_messages_ = true;
- base::RunLoop run_loop;
- run_loop.Run();
- pumping_messages_ = false;
- return !renderer_crashed_;
+ Shell::CloseAllWindows();
+ return true;
}
void WebKitTestController::RendererUnresponsive() {
@@ -240,7 +227,6 @@ void WebKitTestController::PluginCrashed(const FilePath& plugin_path) {
}
void WebKitTestController::RenderViewGone(base::TerminationStatus status) {
- renderer_crashed_ = true;
printer_->AddErrorMessage("#CRASHED - renderer");
}
@@ -275,10 +261,6 @@ void WebKitTestController::TimeoutHandler() {
}
void WebKitTestController::OnDidFinishLoad() {
- if (pumping_messages_) {
- MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure());
- return;
- }
if (wait_until_done_)
return;
CaptureDump();
diff --git a/content/shell/webkit_test_runner_host.h b/content/shell/webkit_test_runner_host.h
index 792f0ee..d5022e2 100644
--- a/content/shell/webkit_test_runner_host.h
+++ b/content/shell/webkit_test_runner_host.h
@@ -126,8 +126,6 @@ class WebKitTestController : public base::NonThreadSafe,
Shell* main_window_;
- bool pumping_messages_;
- bool renderer_crashed_;
bool enable_pixel_dumping_;
std::string expected_pixel_hash_;