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

Unified Diff: content/shell/webkit_test_controller.h

Issue 17395002: content_shell: Use a ThreadRestrictions::ScopedAllowWait for layout tests on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | « base/threading/thread_restrictions.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.h
diff --git a/content/shell/webkit_test_controller.h b/content/shell/webkit_test_controller.h
index b451aba0556786c5d2c5c7bd843976fa5ff94e40..380f5e0add97faecb0a37220aeee497bf49b38b9 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);
};
« no previous file with comments | « base/threading/thread_restrictions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698