From b00a659d469c11e9573e4f4c3f5b0addffe4b0a0 Mon Sep 17 00:00:00 2001 From: "peter@chromium.org" Date: Wed, 28 Aug 2013 16:02:10 +0000 Subject: [PATCH] Run pending tasks in Android's message pump after resetting a layout test. There are tasks left in the queue as part of resetting the previous test which was being ran. Run these before starting the next test, making it possible to run more than one test in a sequence. BUG=232044, 274482 Review URL: https://chromiumcodereview.appspot.com/23089005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@220037 0039d316-1c4b-4281-b951-d872f2087c98 --- content/shell/browser/shell_browser_main.cc | 6 ++++++ content/shell/browser/webkit_test_controller.cc | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/content/shell/browser/shell_browser_main.cc b/content/shell/browser/shell_browser_main.cc index ac520d63bb48..44871db0421e 100644 --- a/content/shell/browser/shell_browser_main.cc +++ b/content/shell/browser/shell_browser_main.cc @@ -194,6 +194,12 @@ int ShellBrowserMain( if (!content::WebKitTestController::Get()->ResetAfterLayoutTest()) break; + +#if defined(OS_ANDROID) + // There will be left-over tasks in the queue for Android because the + // main window is being destroyed. Run them before starting the next test. + base::MessageLoop::current()->RunUntilIdle(); +#endif } if (!ran_at_least_once) { base::MessageLoop::current()->PostTask(FROM_HERE, diff --git a/content/shell/browser/webkit_test_controller.cc b/content/shell/browser/webkit_test_controller.cc index 40ed9c5c5a28..52f06117743d 100644 --- a/content/shell/browser/webkit_test_controller.cc +++ b/content/shell/browser/webkit_test_controller.cc @@ -287,6 +287,12 @@ bool WebKitTestController::ResetAfterLayoutTest() { test_url_ = GURL(); prefs_ = WebPreferences(); should_override_prefs_ = false; + +#if defined(OS_ANDROID) + // Re-using the shell's main window on Android causes issues with networking + // requests never succeeding. See http://crbug.com/277652. + DiscardMainWindow(); +#endif return true; } -- 2.11.4.GIT