diff options
author | peter@chromium.org <peter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-20 20:02:21 +0000 |
---|---|---|
committer | peter@chromium.org <peter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-20 20:02:21 +0000 |
commit | 24ad9ea17ebf454c7d39ba5f429b0f679a4f8a84 (patch) | |
tree | 0257a1a64930dbd8ab5f1961fd21f60c208a858e /content/shell | |
parent | 57d70683af99e601abb08f68651b873d74099475 (diff) | |
download | chromium_src-24ad9ea17ebf454c7d39ba5f429b0f679a4f8a84.zip chromium_src-24ad9ea17ebf454c7d39ba5f429b0f679a4f8a84.tar.gz chromium_src-24ad9ea17ebf454c7d39ba5f429b0f679a4f8a84.tar.bz2 |
content_shell: Use a ThreadRestrictions::ScopedAllowWait for layout tests on Android.
Because of the nested message pump implementation used by Android for
running layout tests, which uses a base::WaitableEvent to wait for new
messages, we need to allow waiting on the UI thread.
The ScopedAllowWaitForAndroidLayoutTest class has been implemented as
a member of the WebKitTestController, to ensure that the exception's
lifetime is tied to the layout test controller itself.
BUG=232044
R=jam@chromium.org, jochen@chromium.org
Review URL: https://codereview.chromium.org/17395002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207523 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/shell')
-rw-r--r-- | content/shell/webkit_test_controller.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/content/shell/webkit_test_controller.h b/content/shell/webkit_test_controller.h index b451aba..380f5e0 100644 --- a/content/shell/webkit_test_controller.h +++ b/content/shell/webkit_test_controller.h @@ -20,12 +20,27 @@ #include "ui/gfx/size.h" #include "webkit/common/webpreferences.h" +#if defined(OS_ANDROID) +#include "base/threading/thread_restrictions.h" +#endif + class SkBitmap; namespace content { class Shell; +#if defined(OS_ANDROID) +// Android uses a nested message loop for running layout tests because the +// default message loop, provided by the system, does not offer a blocking +// Run() method. The loop itself, implemented as NestedMessagePumpAndroid, +// uses a base::WaitableEvent allowing it to sleep until more events arrive. +class ScopedAllowWaitForAndroidLayoutTests { + private: + base::ThreadRestrictions::ScopedAllowWait wait; +}; +#endif + class WebKitTestResultPrinter { public: WebKitTestResultPrinter(std::ostream* output, std::ostream* error); @@ -189,6 +204,12 @@ class WebKitTestController : public base::NonThreadSafe, NotificationRegistrar registrar_; +#if defined(OS_ANDROID) + // Because of the nested message pump implementation, Android needs to allow + // waiting on the UI thread while layout tests are being ran. + ScopedAllowWaitForAndroidLayoutTests reduced_restrictions_; +#endif + DISALLOW_COPY_AND_ASSIGN(WebKitTestController); }; |