| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_SHELL_WEBKIT_TEST_CONTROLLER_H_ | 5 #ifndef CONTENT_SHELL_WEBKIT_TEST_CONTROLLER_H_ |
| 6 #define CONTENT_SHELL_WEBKIT_TEST_CONTROLLER_H_ | 6 #define CONTENT_SHELL_WEBKIT_TEST_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <ostream> | 8 #include <ostream> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/cancelable_callback.h" | 11 #include "base/cancelable_callback.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 14 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
| 15 #include "content/public/browser/gpu_data_manager_observer.h" | 15 #include "content/public/browser/gpu_data_manager_observer.h" |
| 16 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
| 17 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
| 18 #include "content/public/browser/render_view_host_observer.h" | 18 #include "content/public/browser/render_view_host_observer.h" |
| 19 #include "content/public/browser/web_contents_observer.h" | 19 #include "content/public/browser/web_contents_observer.h" |
| 20 #include "ui/gfx/size.h" | 20 #include "ui/gfx/size.h" |
| 21 #include "webkit/common/webpreferences.h" | 21 #include "webkit/common/webpreferences.h" |
| 22 | 22 |
| 23 #if defined(OS_ANDROID) |
| 24 #include "base/threading/thread_restrictions.h" |
| 25 #endif |
| 26 |
| 23 class SkBitmap; | 27 class SkBitmap; |
| 24 | 28 |
| 25 namespace content { | 29 namespace content { |
| 26 | 30 |
| 27 class Shell; | 31 class Shell; |
| 28 | 32 |
| 33 #if defined(OS_ANDROID) |
| 34 // Android uses a nested message loop for running layout tests because the |
| 35 // default message loop, provided by the system, does not offer a blocking |
| 36 // Run() method. The loop itself, implemented as NestedMessagePumpAndroid, |
| 37 // uses a base::WaitableEvent allowing it to sleep until more events arrive. |
| 38 class ScopedAllowWaitForAndroidLayoutTests { |
| 39 private: |
| 40 base::ThreadRestrictions::ScopedAllowWait wait; |
| 41 }; |
| 42 #endif |
| 43 |
| 29 class WebKitTestResultPrinter { | 44 class WebKitTestResultPrinter { |
| 30 public: | 45 public: |
| 31 WebKitTestResultPrinter(std::ostream* output, std::ostream* error); | 46 WebKitTestResultPrinter(std::ostream* output, std::ostream* error); |
| 32 ~WebKitTestResultPrinter(); | 47 ~WebKitTestResultPrinter(); |
| 33 | 48 |
| 34 void reset() { | 49 void reset() { |
| 35 state_ = DURING_TEST; | 50 state_ = DURING_TEST; |
| 36 } | 51 } |
| 37 bool output_finished() const { return state_ == AFTER_TEST; } | 52 bool output_finished() const { return state_ == AFTER_TEST; } |
| 38 void set_capture_text_only(bool capture_text_only) { | 53 void set_capture_text_only(bool capture_text_only) { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 gfx::Size initial_size_; | 197 gfx::Size initial_size_; |
| 183 GURL test_url_; | 198 GURL test_url_; |
| 184 | 199 |
| 185 // True if the WebPreferences of newly created RenderViewHost should be | 200 // True if the WebPreferences of newly created RenderViewHost should be |
| 186 // overridden with prefs_. | 201 // overridden with prefs_. |
| 187 bool should_override_prefs_; | 202 bool should_override_prefs_; |
| 188 WebPreferences prefs_; | 203 WebPreferences prefs_; |
| 189 | 204 |
| 190 NotificationRegistrar registrar_; | 205 NotificationRegistrar registrar_; |
| 191 | 206 |
| 207 #if defined(OS_ANDROID) |
| 208 // Because of the nested message pump implementation, Android needs to allow |
| 209 // waiting on the UI thread while layout tests are being ran. |
| 210 ScopedAllowWaitForAndroidLayoutTests reduced_restrictions_; |
| 211 #endif |
| 212 |
| 192 DISALLOW_COPY_AND_ASSIGN(WebKitTestController); | 213 DISALLOW_COPY_AND_ASSIGN(WebKitTestController); |
| 193 }; | 214 }; |
| 194 | 215 |
| 195 } // namespace content | 216 } // namespace content |
| 196 | 217 |
| 197 #endif // CONTENT_SHELL_WEBKIT_TEST_CONTROLLER_H_ | 218 #endif // CONTENT_SHELL_WEBKIT_TEST_CONTROLLER_H_ |
| OLD | NEW |