Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2358)

Unified Diff: content/shell/webkit_test_controller.cc

Issue 16074003: [content shell] don't open new windows after printing the test results (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: enum Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/shell/webkit_test_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/webkit_test_controller.cc
diff --git a/content/shell/webkit_test_controller.cc b/content/shell/webkit_test_controller.cc
index a07c83e62260edb7cab5d181a57b0fb8c00cbd72..fb3214d390260571659c90e3b9084f9c4d76e165 100644
--- a/content/shell/webkit_test_controller.cc
+++ b/content/shell/webkit_test_controller.cc
@@ -171,7 +171,7 @@ WebKitTestController* WebKitTestController::Get() {
WebKitTestController::WebKitTestController()
: main_window_(NULL),
- is_running_test_(false) {
+ test_phase_(BETWEEN_TESTS) {
CHECK(!instance_);
instance_ = this;
printer_.reset(new WebKitTestResultPrinter(&std::cout, &std::cerr));
@@ -185,7 +185,7 @@ WebKitTestController::WebKitTestController()
WebKitTestController::~WebKitTestController() {
DCHECK(CalledOnValidThread());
CHECK(instance_ == this);
- CHECK(!is_running_test_);
+ CHECK(test_phase_ == BETWEEN_TESTS);
GpuDataManager::GetInstance()->RemoveObserver(this);
DiscardMainWindow();
instance_ = NULL;
@@ -197,7 +197,7 @@ bool WebKitTestController::PrepareForLayoutTest(
bool enable_pixel_dumping,
const std::string& expected_pixel_hash) {
DCHECK(CalledOnValidThread());
- is_running_test_ = true;
+ test_phase_ = DURING_TEST;
current_working_directory_ = current_working_directory;
enable_pixel_dumping_ = enable_pixel_dumping;
expected_pixel_hash_ = expected_pixel_hash;
@@ -263,7 +263,7 @@ bool WebKitTestController::ResetAfterLayoutTest() {
printer_->PrintTextFooter();
printer_->PrintImageFooter();
send_configuration_to_next_host_ = false;
- is_running_test_ = false;
+ test_phase_ = BETWEEN_TESTS;
is_compositing_test_ = false;
enable_pixel_dumping_ = false;
expected_pixel_hash_.clear();
@@ -299,6 +299,9 @@ void WebKitTestController::OverrideWebkitPrefs(WebPreferences* prefs) {
}
void WebKitTestController::OpenURL(const GURL& url) {
+ if (test_phase_ != DURING_TEST)
+ return;
+
Shell::CreateNewWindow(main_window_->web_contents()->GetBrowserContext(),
url,
main_window_->web_contents()->GetSiteInstance(),
@@ -424,10 +427,11 @@ void WebKitTestController::DiscardMainWindow() {
// loop. Otherwise, we're already outside of the message loop, and we just
// discard the main window.
WebContentsObserver::Observe(NULL);
- if (is_running_test_) {
+ if (test_phase_ != BETWEEN_TESTS) {
Shell::CloseAllWindows();
base::MessageLoop::current()->PostTask(FROM_HERE,
base::MessageLoop::QuitClosure());
+ test_phase_ = CLEAN_UP;
} else if (main_window_) {
main_window_->Close();
}
@@ -463,6 +467,7 @@ void WebKitTestController::OnTestFinished(bool did_timeout) {
DiscardMainWindow();
return;
}
+ test_phase_ = CLEAN_UP;
if (!printer_->output_finished())
printer_->PrintImageFooter();
RenderViewHost* render_view_host =
« no previous file with comments | « content/shell/webkit_test_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698