| 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_LAYOUT_TEST_BLINK_TEST_CONTROLLER_H_ | 5 #ifndef CONTENT_SHELL_BROWSER_LAYOUT_TEST_BLINK_TEST_CONTROLLER_H_ |
| 6 #define CONTENT_SHELL_BROWSER_LAYOUT_TEST_BLINK_TEST_CONTROLLER_H_ | 6 #define CONTENT_SHELL_BROWSER_LAYOUT_TEST_BLINK_TEST_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <ostream> | 10 #include <ostream> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/cancelable_callback.h" | 14 #include "base/cancelable_callback.h" |
| 15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/scoped_observer.h" | 17 #include "base/scoped_observer.h" |
| 18 #include "base/sequence_checker.h" | 18 #include "base/sequence_checker.h" |
| 19 #include "base/synchronization/lock.h" | 19 #include "base/synchronization/lock.h" |
| 20 #include "base/values.h" | 20 #include "base/values.h" |
| 21 #include "build/build_config.h" | 21 #include "build/build_config.h" |
| 22 #include "content/public/browser/bluetooth_chooser.h" | 22 #include "content/public/browser/bluetooth_chooser.h" |
| 23 #include "content/public/browser/gpu_data_manager_observer.h" | 23 #include "content/public/browser/gpu_data_manager_observer.h" |
| 24 #include "content/public/browser/notification_observer.h" | 24 #include "content/public/browser/notification_observer.h" |
| 25 #include "content/public/browser/notification_registrar.h" | 25 #include "content/public/browser/notification_registrar.h" |
| 26 #include "content/public/browser/readback_types.h" |
| 26 #include "content/public/browser/render_process_host_observer.h" | 27 #include "content/public/browser/render_process_host_observer.h" |
| 27 #include "content/public/browser/web_contents_observer.h" | 28 #include "content/public/browser/web_contents_observer.h" |
| 28 #include "content/public/common/web_preferences.h" | 29 #include "content/public/common/web_preferences.h" |
| 29 #include "content/shell/common/layout_test.mojom.h" | 30 #include "content/shell/common/layout_test.mojom.h" |
| 30 #include "content/shell/common/leak_detection_result.h" | 31 #include "content/shell/common/leak_detection_result.h" |
| 31 #include "ui/gfx/geometry/size.h" | 32 #include "ui/gfx/geometry/size.h" |
| 32 | 33 |
| 33 #if defined(OS_ANDROID) | 34 #if defined(OS_ANDROID) |
| 34 #include "base/threading/thread_restrictions.h" | 35 #include "base/threading/thread_restrictions.h" |
| 35 #endif | 36 #endif |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 196 |
| 196 Shell* SecondaryWindow(); | 197 Shell* SecondaryWindow(); |
| 197 void LoadDevToolsJSTest(); | 198 void LoadDevToolsJSTest(); |
| 198 void DiscardMainWindow(); | 199 void DiscardMainWindow(); |
| 199 | 200 |
| 200 // Message handlers. | 201 // Message handlers. |
| 201 void OnAudioDump(const std::vector<unsigned char>& audio_dump); | 202 void OnAudioDump(const std::vector<unsigned char>& audio_dump); |
| 202 void OnImageDump(const std::string& actual_pixel_hash, const SkBitmap& image); | 203 void OnImageDump(const std::string& actual_pixel_hash, const SkBitmap& image); |
| 203 void OnTextDump(const std::string& dump); | 204 void OnTextDump(const std::string& dump); |
| 204 void OnInitiateLayoutDump(); | 205 void OnInitiateLayoutDump(); |
| 206 void OnInitiatePixelsDump(); |
| 207 void TriggerCompositingIfAllChildrenHaveBeenComposited(); |
| 208 void TriggerCompositing(RenderFrameHost* frame); |
| 209 void OnTriggerCompositingResponse(int frame_tree_node_id, int process_id); |
| 205 void OnDumpFrameLayoutResponse(int frame_tree_node_id, | 210 void OnDumpFrameLayoutResponse(int frame_tree_node_id, |
| 206 const std::string& dump); | 211 const std::string& dump); |
| 212 void OnPixelsDumpCaptured(const SkBitmap& dump, ReadbackResponse response); |
| 207 void OnPrintMessageToStderr(const std::string& message); | 213 void OnPrintMessageToStderr(const std::string& message); |
| 208 void OnPrintMessage(const std::string& message); | 214 void OnPrintMessage(const std::string& message); |
| 209 void OnOverridePreferences(const WebPreferences& prefs); | 215 void OnOverridePreferences(const WebPreferences& prefs); |
| 210 void OnSetPopupBlockingEnabled(bool block_popups); | 216 void OnSetPopupBlockingEnabled(bool block_popups); |
| 211 void OnTestFinished(); | 217 void OnTestFinished(); |
| 212 void OnClearDevToolsLocalStorage(); | 218 void OnClearDevToolsLocalStorage(); |
| 213 void OnShowDevTools(const std::string& settings, | 219 void OnShowDevTools(const std::string& settings, |
| 214 const std::string& frontend_url); | 220 const std::string& frontend_url); |
| 215 void OnEvaluateInDevTools(int call_id, const std::string& script); | 221 void OnEvaluateInDevTools(int call_id, const std::string& script); |
| 216 void OnCloseDevTools(); | 222 void OnCloseDevTools(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 bool should_override_prefs_; | 279 bool should_override_prefs_; |
| 274 WebPreferences prefs_; | 280 WebPreferences prefs_; |
| 275 | 281 |
| 276 NotificationRegistrar registrar_; | 282 NotificationRegistrar registrar_; |
| 277 | 283 |
| 278 const bool is_leak_detection_enabled_; | 284 const bool is_leak_detection_enabled_; |
| 279 bool crash_when_leak_found_; | 285 bool crash_when_leak_found_; |
| 280 | 286 |
| 281 std::unique_ptr<LayoutTestBluetoothChooserFactory> bluetooth_chooser_factory_; | 287 std::unique_ptr<LayoutTestBluetoothChooserFactory> bluetooth_chooser_factory_; |
| 282 | 288 |
| 283 // Map from frame_tree_node_id into frame-specific dumps. | 289 // Map from frame_tree_node_id into frame-specific text/layout dumps. |
| 284 std::map<int, std::string> frame_to_layout_dump_map_; | 290 std::map<int, std::string> frame_to_layout_dump_map_; |
| 285 // Number of LayoutTestControl.DumpFrameLayout responses we are waiting for. | 291 // Number of LayoutTestControl.DumpFrameLayout responses we are waiting for. |
| 286 int pending_layout_dumps_; | 292 int pending_layout_dumps_; |
| 287 | 293 |
| 294 // Stores frame tree node ids of already composited frames (frames for which |
| 295 // OnTriggerCompositingResponse was already called). |
| 296 std::set<int> composited_frames_; |
| 297 |
| 288 // Renderer processes are observed to detect crashes. | 298 // Renderer processes are observed to detect crashes. |
| 289 ScopedObserver<RenderProcessHost, RenderProcessHostObserver> | 299 ScopedObserver<RenderProcessHost, RenderProcessHostObserver> |
| 290 render_process_host_observer_; | 300 render_process_host_observer_; |
| 291 std::set<RenderProcessHost*> all_observed_render_process_hosts_; | 301 std::set<RenderProcessHost*> all_observed_render_process_hosts_; |
| 292 std::set<RenderProcessHost*> main_window_render_process_hosts_; | 302 std::set<RenderProcessHost*> main_window_render_process_hosts_; |
| 293 | 303 |
| 294 // Changes reported by OnLayoutTestRuntimeFlagsChanged that have accumulated | 304 // Changes reported by OnLayoutTestRuntimeFlagsChanged that have accumulated |
| 295 // since PrepareForLayoutTest (i.e. changes that need to be send to a fresh | 305 // since PrepareForLayoutTest (i.e. changes that need to be send to a fresh |
| 296 // renderer created while test is in progress). | 306 // renderer created while test is in progress). |
| 297 base::DictionaryValue accumulated_layout_test_runtime_flags_changes_; | 307 base::DictionaryValue accumulated_layout_test_runtime_flags_changes_; |
| 298 | 308 |
| 299 // Map from one frame to one mojo pipe. | 309 // Map from one frame to one mojo pipe. |
| 300 std::map<RenderFrameHost*, mojom::LayoutTestControlAssociatedPtr> | 310 std::map<RenderFrameHost*, mojom::LayoutTestControlAssociatedPtr> |
| 301 layout_test_control_map_; | 311 layout_test_control_map_; |
| 302 #if defined(OS_ANDROID) | 312 #if defined(OS_ANDROID) |
| 303 // Because of the nested message pump implementation, Android needs to allow | 313 // Because of the nested message pump implementation, Android needs to allow |
| 304 // waiting on the UI thread while layout tests are being ran. | 314 // waiting on the UI thread while layout tests are being ran. |
| 305 ScopedAllowWaitForAndroidLayoutTests reduced_restrictions_; | 315 ScopedAllowWaitForAndroidLayoutTests reduced_restrictions_; |
| 306 #endif | 316 #endif |
| 307 | 317 |
| 308 SEQUENCE_CHECKER(sequence_checker_); | 318 SEQUENCE_CHECKER(sequence_checker_); |
| 309 | 319 |
| 310 DISALLOW_COPY_AND_ASSIGN(BlinkTestController); | 320 DISALLOW_COPY_AND_ASSIGN(BlinkTestController); |
| 311 }; | 321 }; |
| 312 | 322 |
| 313 } // namespace content | 323 } // namespace content |
| 314 | 324 |
| 315 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_BLINK_TEST_CONTROLLER_H_ | 325 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_BLINK_TEST_CONTROLLER_H_ |
| OLD | NEW |