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 <ostream> | 9 #include <ostream> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/cancelable_callback.h" | 12 #include "base/cancelable_callback.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/scoped_observer.h" | 16 #include "base/scoped_observer.h" |
17 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
18 #include "base/threading/non_thread_safe.h" | 18 #include "base/threading/non_thread_safe.h" |
| 19 #include "base/values.h" |
19 #include "build/build_config.h" | 20 #include "build/build_config.h" |
20 #include "content/public/browser/bluetooth_chooser.h" | 21 #include "content/public/browser/bluetooth_chooser.h" |
21 #include "content/public/browser/gpu_data_manager_observer.h" | 22 #include "content/public/browser/gpu_data_manager_observer.h" |
22 #include "content/public/browser/notification_observer.h" | 23 #include "content/public/browser/notification_observer.h" |
23 #include "content/public/browser/notification_registrar.h" | 24 #include "content/public/browser/notification_registrar.h" |
24 #include "content/public/browser/render_process_host_observer.h" | 25 #include "content/public/browser/render_process_host_observer.h" |
25 #include "content/public/browser/web_contents_observer.h" | 26 #include "content/public/browser/web_contents_observer.h" |
26 #include "content/public/common/web_preferences.h" | 27 #include "content/public/common/web_preferences.h" |
27 #include "content/shell/common/leak_detection_result.h" | 28 #include "content/shell/common/leak_detection_result.h" |
28 #include "ui/gfx/geometry/size.h" | 29 #include "ui/gfx/geometry/size.h" |
29 | 30 |
30 #if defined(OS_ANDROID) | 31 #if defined(OS_ANDROID) |
31 #include "base/threading/thread_restrictions.h" | 32 #include "base/threading/thread_restrictions.h" |
32 #endif | 33 #endif |
33 | 34 |
34 class SkBitmap; | 35 class SkBitmap; |
35 | 36 |
36 namespace test_runner { | |
37 struct LayoutDumpFlags; | |
38 } | |
39 | |
40 namespace url { | 37 namespace url { |
41 class Origin; | 38 class Origin; |
42 } | 39 } |
43 | 40 |
44 namespace content { | 41 namespace content { |
45 | 42 |
46 class LayoutTestBluetoothChooserFactory; | 43 class LayoutTestBluetoothChooserFactory; |
47 class LayoutTestDevToolsFrontend; | 44 class LayoutTestDevToolsFrontend; |
48 class RenderFrameHost; | 45 class RenderFrameHost; |
49 class RenderProcessHost; | 46 class RenderProcessHost; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 static BlinkTestController* instance_; | 184 static BlinkTestController* instance_; |
188 | 185 |
189 void DiscardMainWindow(); | 186 void DiscardMainWindow(); |
190 void HandleNewRenderFrameHost( | 187 void HandleNewRenderFrameHost( |
191 RenderFrameHost* frame_representing_target_process); | 188 RenderFrameHost* frame_representing_target_process); |
192 | 189 |
193 // Message handlers. | 190 // Message handlers. |
194 void OnAudioDump(const std::vector<unsigned char>& audio_dump); | 191 void OnAudioDump(const std::vector<unsigned char>& audio_dump); |
195 void OnImageDump(const std::string& actual_pixel_hash, const SkBitmap& image); | 192 void OnImageDump(const std::string& actual_pixel_hash, const SkBitmap& image); |
196 void OnTextDump(const std::string& dump); | 193 void OnTextDump(const std::string& dump); |
197 void OnInitiateLayoutDump( | 194 void OnInitiateLayoutDump(); |
198 const test_runner::LayoutDumpFlags& layout_dump_flags); | 195 void OnLayoutDumpFlagsChanged( |
| 196 RenderFrameHost* sender, |
| 197 const base::DictionaryValue& changed_layout_dump_flags); |
199 void OnLayoutDumpResponse(RenderFrameHost* sender, const std::string& dump); | 198 void OnLayoutDumpResponse(RenderFrameHost* sender, const std::string& dump); |
200 void OnPrintMessage(const std::string& message); | 199 void OnPrintMessage(const std::string& message); |
201 void OnOverridePreferences(const WebPreferences& prefs); | 200 void OnOverridePreferences(const WebPreferences& prefs); |
202 void OnTestFinished(); | 201 void OnTestFinished(); |
203 void OnClearDevToolsLocalStorage(); | 202 void OnClearDevToolsLocalStorage(); |
204 void OnShowDevTools(const std::string& settings, | 203 void OnShowDevTools(const std::string& settings, |
205 const std::string& frontend_url); | 204 const std::string& frontend_url); |
206 void OnCloseDevTools(); | 205 void OnCloseDevTools(); |
207 void OnGoToOffset(int offset); | 206 void OnGoToOffset(int offset); |
208 void OnReload(); | 207 void OnReload(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 257 |
259 // Map from frame_tree_node_id into frame-specific dumps. | 258 // Map from frame_tree_node_id into frame-specific dumps. |
260 std::map<int, std::string> frame_to_layout_dump_map_; | 259 std::map<int, std::string> frame_to_layout_dump_map_; |
261 // Number of ShellViewHostMsg_LayoutDumpResponse messages we are waiting for. | 260 // Number of ShellViewHostMsg_LayoutDumpResponse messages we are waiting for. |
262 int pending_layout_dumps_; | 261 int pending_layout_dumps_; |
263 | 262 |
264 // Renderer processes are observed to detect crashes. | 263 // Renderer processes are observed to detect crashes. |
265 ScopedObserver<RenderProcessHost, RenderProcessHostObserver> | 264 ScopedObserver<RenderProcessHost, RenderProcessHostObserver> |
266 render_process_host_observer_; | 265 render_process_host_observer_; |
267 | 266 |
| 267 // Changes reported by OnLayoutDumpFlagsChanged that have accumulated since |
| 268 // PrepareForLayoutTest (i.e. changes that need to be send to a fresh |
| 269 // renderer created while test is in progress). |
| 270 base::DictionaryValue accumulated_layout_dump_flags_changes_; |
| 271 |
268 #if defined(OS_ANDROID) | 272 #if defined(OS_ANDROID) |
269 // Because of the nested message pump implementation, Android needs to allow | 273 // Because of the nested message pump implementation, Android needs to allow |
270 // waiting on the UI thread while layout tests are being ran. | 274 // waiting on the UI thread while layout tests are being ran. |
271 ScopedAllowWaitForAndroidLayoutTests reduced_restrictions_; | 275 ScopedAllowWaitForAndroidLayoutTests reduced_restrictions_; |
272 #endif | 276 #endif |
273 | 277 |
274 DISALLOW_COPY_AND_ASSIGN(BlinkTestController); | 278 DISALLOW_COPY_AND_ASSIGN(BlinkTestController); |
275 }; | 279 }; |
276 | 280 |
277 } // namespace content | 281 } // namespace content |
278 | 282 |
279 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_BLINK_TEST_CONTROLLER_H_ | 283 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_BLINK_TEST_CONTROLLER_H_ |
OLD | NEW |