| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BROWSER_BLINK_TEST_CONTROLLER_H_ | 5 #ifndef CONTENT_SHELL_BROWSER_BLINK_TEST_CONTROLLER_H_ |
| 6 #define CONTENT_SHELL_BROWSER_BLINK_TEST_CONTROLLER_H_ | 6 #define CONTENT_SHELL_BROWSER_BLINK_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/memory/scoped_ptr.h" |
| 13 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
| 14 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/non_thread_safe.h" |
| 16 #include "content/public/browser/bluetooth_chooser.h" |
| 15 #include "content/public/browser/gpu_data_manager_observer.h" | 17 #include "content/public/browser/gpu_data_manager_observer.h" |
| 16 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
| 17 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
| 18 #include "content/public/browser/web_contents_observer.h" | 20 #include "content/public/browser/web_contents_observer.h" |
| 19 #include "content/public/common/web_preferences.h" | 21 #include "content/public/common/web_preferences.h" |
| 20 #include "content/shell/common/leak_detection_result.h" | 22 #include "content/shell/common/leak_detection_result.h" |
| 21 #include "ui/gfx/geometry/size.h" | 23 #include "ui/gfx/geometry/size.h" |
| 22 | 24 |
| 23 #if defined(OS_ANDROID) | 25 #if defined(OS_ANDROID) |
| 24 #include "base/threading/thread_restrictions.h" | 26 #include "base/threading/thread_restrictions.h" |
| 25 #endif | 27 #endif |
| 26 | 28 |
| 27 class SkBitmap; | 29 class SkBitmap; |
| 28 | 30 |
| 29 namespace content { | 31 namespace content { |
| 30 | 32 |
| 33 class LayoutTestBluetoothChooserFactory; |
| 31 class LayoutTestDevToolsFrontend; | 34 class LayoutTestDevToolsFrontend; |
| 32 class Shell; | 35 class Shell; |
| 33 | 36 |
| 34 #if defined(OS_ANDROID) | 37 #if defined(OS_ANDROID) |
| 35 // Android uses a nested message loop for running layout tests because the | 38 // Android uses a nested message loop for running layout tests because the |
| 36 // default message loop, provided by the system, does not offer a blocking | 39 // default message loop, provided by the system, does not offer a blocking |
| 37 // Run() method. The loop itself, implemented as NestedMessagePumpAndroid, | 40 // Run() method. The loop itself, implemented as NestedMessagePumpAndroid, |
| 38 // uses a base::WaitableEvent allowing it to sleep until more events arrive. | 41 // uses a base::WaitableEvent allowing it to sleep until more events arrive. |
| 39 class ScopedAllowWaitForAndroidLayoutTests { | 42 class ScopedAllowWaitForAndroidLayoutTests { |
| 40 private: | 43 private: |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 const std::string& expected_pixel_hash); | 119 const std::string& expected_pixel_hash); |
| 117 // True if the controller was reset successfully. | 120 // True if the controller was reset successfully. |
| 118 bool ResetAfterLayoutTest(); | 121 bool ResetAfterLayoutTest(); |
| 119 | 122 |
| 120 void SetTempPath(const base::FilePath& temp_path); | 123 void SetTempPath(const base::FilePath& temp_path); |
| 121 void RendererUnresponsive(); | 124 void RendererUnresponsive(); |
| 122 void OverrideWebkitPrefs(WebPreferences* prefs); | 125 void OverrideWebkitPrefs(WebPreferences* prefs); |
| 123 void OpenURL(const GURL& url); | 126 void OpenURL(const GURL& url); |
| 124 void TestFinishedInSecondaryWindow(); | 127 void TestFinishedInSecondaryWindow(); |
| 125 bool IsMainWindow(WebContents* web_contents) const; | 128 bool IsMainWindow(WebContents* web_contents) const; |
| 129 scoped_ptr<BluetoothChooser> RunBluetoothChooser( |
| 130 WebContents* web_contents, |
| 131 const BluetoothChooser::EventHandler& event_handler, |
| 132 const GURL& origin); |
| 126 | 133 |
| 127 BlinkTestResultPrinter* printer() { return printer_.get(); } | 134 BlinkTestResultPrinter* printer() { return printer_.get(); } |
| 128 void set_printer(BlinkTestResultPrinter* printer) { printer_.reset(printer); } | 135 void set_printer(BlinkTestResultPrinter* printer) { printer_.reset(printer); } |
| 129 | 136 |
| 130 void DevToolsProcessCrashed(); | 137 void DevToolsProcessCrashed(); |
| 131 | 138 |
| 132 // WebContentsObserver implementation. | 139 // WebContentsObserver implementation. |
| 133 bool OnMessageReceived(const IPC::Message& message) override; | 140 bool OnMessageReceived(const IPC::Message& message) override; |
| 134 void PluginCrashed(const base::FilePath& plugin_path, | 141 void PluginCrashed(const base::FilePath& plugin_path, |
| 135 base::ProcessId plugin_pid) override; | 142 base::ProcessId plugin_pid) override; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 void OnShowDevTools(const std::string& settings, | 175 void OnShowDevTools(const std::string& settings, |
| 169 const std::string& frontend_url); | 176 const std::string& frontend_url); |
| 170 void OnCloseDevTools(); | 177 void OnCloseDevTools(); |
| 171 void OnGoToOffset(int offset); | 178 void OnGoToOffset(int offset); |
| 172 void OnReload(); | 179 void OnReload(); |
| 173 void OnLoadURLForFrame(const GURL& url, const std::string& frame_name); | 180 void OnLoadURLForFrame(const GURL& url, const std::string& frame_name); |
| 174 void OnCaptureSessionHistory(); | 181 void OnCaptureSessionHistory(); |
| 175 void OnCloseRemainingWindows(); | 182 void OnCloseRemainingWindows(); |
| 176 void OnResetDone(); | 183 void OnResetDone(); |
| 177 void OnLeakDetectionDone(const content::LeakDetectionResult& result); | 184 void OnLeakDetectionDone(const content::LeakDetectionResult& result); |
| 185 void OnSetBluetoothManualChooser(bool enable); |
| 186 void OnGetBluetoothManualChooserEvents(std::vector<std::string>* events); |
| 187 void OnSendBluetoothManualChooserEvent(const std::string& event, |
| 188 const std::string& argument); |
| 178 | 189 |
| 179 scoped_ptr<BlinkTestResultPrinter> printer_; | 190 scoped_ptr<BlinkTestResultPrinter> printer_; |
| 180 | 191 |
| 181 base::FilePath current_working_directory_; | 192 base::FilePath current_working_directory_; |
| 182 base::FilePath temp_path_; | 193 base::FilePath temp_path_; |
| 183 | 194 |
| 184 Shell* main_window_; | 195 Shell* main_window_; |
| 185 | 196 |
| 186 // The PID of the render process of the render view host of main_window_. | 197 // The PID of the render process of the render view host of main_window_. |
| 187 int current_pid_; | 198 int current_pid_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 207 bool should_override_prefs_; | 218 bool should_override_prefs_; |
| 208 WebPreferences prefs_; | 219 WebPreferences prefs_; |
| 209 | 220 |
| 210 NotificationRegistrar registrar_; | 221 NotificationRegistrar registrar_; |
| 211 | 222 |
| 212 const bool is_leak_detection_enabled_; | 223 const bool is_leak_detection_enabled_; |
| 213 bool crash_when_leak_found_; | 224 bool crash_when_leak_found_; |
| 214 | 225 |
| 215 LayoutTestDevToolsFrontend* devtools_frontend_; | 226 LayoutTestDevToolsFrontend* devtools_frontend_; |
| 216 | 227 |
| 228 scoped_ptr<LayoutTestBluetoothChooserFactory> bluetooth_chooser_factory_; |
| 229 |
| 217 #if defined(OS_ANDROID) | 230 #if defined(OS_ANDROID) |
| 218 // Because of the nested message pump implementation, Android needs to allow | 231 // Because of the nested message pump implementation, Android needs to allow |
| 219 // waiting on the UI thread while layout tests are being ran. | 232 // waiting on the UI thread while layout tests are being ran. |
| 220 ScopedAllowWaitForAndroidLayoutTests reduced_restrictions_; | 233 ScopedAllowWaitForAndroidLayoutTests reduced_restrictions_; |
| 221 #endif | 234 #endif |
| 222 | 235 |
| 223 DISALLOW_COPY_AND_ASSIGN(BlinkTestController); | 236 DISALLOW_COPY_AND_ASSIGN(BlinkTestController); |
| 224 }; | 237 }; |
| 225 | 238 |
| 226 } // namespace content | 239 } // namespace content |
| 227 | 240 |
| 228 #endif // CONTENT_SHELL_BROWSER_BLINK_TEST_CONTROLLER_H_ | 241 #endif // CONTENT_SHELL_BROWSER_BLINK_TEST_CONTROLLER_H_ |
| OLD | NEW |