| 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_RENDERER_LAYOUT_TEST_BLINK_TEST_RUNNER_H_ | 5 #ifndef CONTENT_SHELL_RENDERER_LAYOUT_TEST_BLINK_TEST_RUNNER_H_ |
| 6 #define CONTENT_SHELL_RENDERER_LAYOUT_TEST_BLINK_TEST_RUNNER_H_ | 6 #define CONTENT_SHELL_RENDERER_LAYOUT_TEST_BLINK_TEST_RUNNER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "components/test_runner/test_preferences.h" | 15 #include "components/test_runner/test_preferences.h" |
| 16 #include "components/test_runner/web_test_delegate.h" | 16 #include "components/test_runner/web_test_delegate.h" |
| 17 #include "content/public/common/page_state.h" | 17 #include "content/public/common/page_state.h" |
| 18 #include "content/public/renderer/render_view_observer.h" | 18 #include "content/public/renderer/render_view_observer.h" |
| 19 #include "content/public/renderer/render_view_observer_tracker.h" | 19 #include "content/public/renderer/render_view_observer_tracker.h" |
| 20 #include "content/shell/common/shell_test_configuration.h" | 20 #include "content/shell/common/shell_test_configuration.h" |
| 21 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree
nOrientationType.h" | 21 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree
nOrientationType.h" |
| 22 #include "v8/include/v8.h" | 22 #include "v8/include/v8.h" |
| 23 | 23 |
| 24 class SkBitmap; | 24 class SkBitmap; |
| 25 class SkCanvas; | 25 class SkCanvas; |
| 26 | 26 |
| 27 namespace base { |
| 28 class DictionaryValue; |
| 29 } |
| 30 |
| 27 namespace blink { | 31 namespace blink { |
| 28 class WebDeviceMotionData; | 32 class WebDeviceMotionData; |
| 29 class WebDeviceOrientationData; | 33 class WebDeviceOrientationData; |
| 30 struct WebRect; | 34 struct WebRect; |
| 31 } | 35 } |
| 32 | 36 |
| 33 namespace test_runner { | 37 namespace test_runner { |
| 38 class LayoutDumpFlags; |
| 34 class WebTestProxyBase; | 39 class WebTestProxyBase; |
| 35 } | 40 } |
| 36 | 41 |
| 37 namespace content { | 42 namespace content { |
| 38 | 43 |
| 39 class LeakDetector; | 44 class LeakDetector; |
| 40 struct LeakDetectionResult; | 45 struct LeakDetectionResult; |
| 41 | 46 |
| 42 // This is the renderer side of the webkit test runner. | 47 // This is the renderer side of the webkit test runner. |
| 43 // TODO(lukasza): Rename to LayoutTestRenderViewObserver for consistency with | 48 // TODO(lukasza): Rename to LayoutTestRenderViewObserver for consistency with |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 override; | 115 override; |
| 111 void SendBluetoothManualChooserEvent(const std::string& event, | 116 void SendBluetoothManualChooserEvent(const std::string& event, |
| 112 const std::string& argument) override; | 117 const std::string& argument) override; |
| 113 void SetGeofencingMockProvider(bool service_available) override; | 118 void SetGeofencingMockProvider(bool service_available) override; |
| 114 void ClearGeofencingMockProvider() override; | 119 void ClearGeofencingMockProvider() override; |
| 115 void SetGeofencingMockPosition(double latitude, double longitude) override; | 120 void SetGeofencingMockPosition(double latitude, double longitude) override; |
| 116 void SetFocus(test_runner::WebTestProxyBase* proxy, bool focus) override; | 121 void SetFocus(test_runner::WebTestProxyBase* proxy, bool focus) override; |
| 117 void SetAcceptAllCookies(bool accept) override; | 122 void SetAcceptAllCookies(bool accept) override; |
| 118 std::string PathToLocalResource(const std::string& resource) override; | 123 std::string PathToLocalResource(const std::string& resource) override; |
| 119 void SetLocale(const std::string& locale) override; | 124 void SetLocale(const std::string& locale) override; |
| 125 void OnLayoutDumpFlagsChanged( |
| 126 test_runner::LayoutDumpFlags* layout_dump_flags) override; |
| 120 void TestFinished() override; | 127 void TestFinished() override; |
| 121 void CloseRemainingWindows() override; | 128 void CloseRemainingWindows() override; |
| 122 void DeleteAllCookies() override; | 129 void DeleteAllCookies() override; |
| 123 int NavigationEntryCount() override; | 130 int NavigationEntryCount() override; |
| 124 void GoToOffset(int offset) override; | 131 void GoToOffset(int offset) override; |
| 125 void Reload() override; | 132 void Reload() override; |
| 126 void LoadURLForFrame(const blink::WebURL& url, | 133 void LoadURLForFrame(const blink::WebURL& url, |
| 127 const std::string& frame_name) override; | 134 const std::string& frame_name) override; |
| 128 bool AllowExternalPages() override; | 135 bool AllowExternalPages() override; |
| 129 std::string DumpHistoryForWindow( | 136 std::string DumpHistoryForWindow( |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 // also resets additional state, like the main frame's name and opener. | 171 // also resets additional state, like the main frame's name and opener. |
| 165 void Reset(bool for_new_test); | 172 void Reset(bool for_new_test); |
| 166 | 173 |
| 167 void set_proxy(test_runner::WebTestProxyBase* proxy) { proxy_ = proxy; } | 174 void set_proxy(test_runner::WebTestProxyBase* proxy) { proxy_ = proxy; } |
| 168 test_runner::WebTestProxyBase* proxy() const { return proxy_; } | 175 test_runner::WebTestProxyBase* proxy() const { return proxy_; } |
| 169 | 176 |
| 170 void ReportLeakDetectionResult(const LeakDetectionResult& result); | 177 void ReportLeakDetectionResult(const LeakDetectionResult& result); |
| 171 | 178 |
| 172 // Message handlers forwarded by LayoutTestRenderFrameObserver. | 179 // Message handlers forwarded by LayoutTestRenderFrameObserver. |
| 173 void OnSetTestConfiguration(const ShellTestConfiguration& params); | 180 void OnSetTestConfiguration(const ShellTestConfiguration& params); |
| 174 void OnReplicateTestConfiguration(const ShellTestConfiguration& params); | 181 void OnReplicateTestConfiguration( |
| 182 const ShellTestConfiguration& params, |
| 183 const base::DictionaryValue& accumulated_layout_dump_flags_changes); |
| 184 void OnReplicateLayoutDumpFlagsChanges( |
| 185 const base::DictionaryValue& changed_layout_dump_flags, |
| 186 const std::string& change_originator_guid); |
| 175 | 187 |
| 176 private: | 188 private: |
| 177 // Message handlers. | 189 // Message handlers. |
| 178 void OnSessionHistory( | 190 void OnSessionHistory( |
| 179 const std::vector<int>& routing_ids, | 191 const std::vector<int>& routing_ids, |
| 180 const std::vector<std::vector<PageState> >& session_histories, | 192 const std::vector<std::vector<PageState> >& session_histories, |
| 181 const std::vector<unsigned>& current_entry_indexes); | 193 const std::vector<unsigned>& current_entry_indexes); |
| 182 void OnReset(); | 194 void OnReset(); |
| 183 void OnNotifyDone(); | 195 void OnNotifyDone(); |
| 184 void OnTryLeakDetection(); | 196 void OnTryLeakDetection(); |
| 185 void OnReplyBluetoothManualChooserEvents( | 197 void OnReplyBluetoothManualChooserEvents( |
| 186 const std::vector<std::string>& events); | 198 const std::vector<std::string>& events); |
| 187 | 199 |
| 200 // Helpers. |
| 201 void SetTestConfiguration(const ShellTestConfiguration& params); |
| 202 |
| 188 // After finishing the test, retrieves the audio, text, and pixel dumps from | 203 // After finishing the test, retrieves the audio, text, and pixel dumps from |
| 189 // the TestRunner library and sends them to the browser process. | 204 // the TestRunner library and sends them to the browser process. |
| 190 void CaptureDump(); | 205 void CaptureDump(); |
| 191 void OnLayoutDumpCompleted(std::string completed_layout_dump); | 206 void OnLayoutDumpCompleted(std::string completed_layout_dump); |
| 192 void CaptureDumpContinued(); | 207 void CaptureDumpContinued(); |
| 193 void OnPixelsDumpCompleted(const SkBitmap& snapshot); | 208 void OnPixelsDumpCompleted(const SkBitmap& snapshot); |
| 194 void CaptureDumpComplete(); | 209 void CaptureDumpComplete(); |
| 195 | 210 |
| 196 test_runner::WebTestProxyBase* proxy_; | 211 test_runner::WebTestProxyBase* proxy_; |
| 197 | 212 |
| 198 RenderView* focused_view_; | 213 RenderView* focused_view_; |
| 199 | 214 |
| 200 test_runner::TestPreferences prefs_; | 215 test_runner::TestPreferences prefs_; |
| 201 | 216 |
| 202 ShellTestConfiguration test_config_; | 217 ShellTestConfiguration test_config_; |
| 203 | 218 |
| 204 std::vector<int> routing_ids_; | 219 std::vector<int> routing_ids_; |
| 205 std::vector<std::vector<PageState> > session_histories_; | 220 std::vector<std::vector<PageState> > session_histories_; |
| 206 std::vector<unsigned> current_entry_indexes_; | 221 std::vector<unsigned> current_entry_indexes_; |
| 207 | 222 |
| 208 std::deque<base::Callback<void(const std::vector<std::string>&)>> | 223 std::deque<base::Callback<void(const std::vector<std::string>&)>> |
| 209 get_bluetooth_events_callbacks_; | 224 get_bluetooth_events_callbacks_; |
| 210 | 225 |
| 211 bool is_main_window_; | 226 bool is_main_window_; |
| 212 | 227 |
| 213 bool focus_on_next_commit_; | 228 bool focus_on_next_commit_; |
| 214 | 229 |
| 215 scoped_ptr<LeakDetector> leak_detector_; | 230 scoped_ptr<LeakDetector> leak_detector_; |
| 216 | 231 |
| 232 std::string guid_; // Unique identifier of this BlinkTestRunner instance. |
| 233 |
| 217 DISALLOW_COPY_AND_ASSIGN(BlinkTestRunner); | 234 DISALLOW_COPY_AND_ASSIGN(BlinkTestRunner); |
| 218 }; | 235 }; |
| 219 | 236 |
| 220 } // namespace content | 237 } // namespace content |
| 221 | 238 |
| 222 #endif // CONTENT_SHELL_RENDERER_LAYOUT_TEST_BLINK_TEST_RUNNER_H_ | 239 #endif // CONTENT_SHELL_RENDERER_LAYOUT_TEST_BLINK_TEST_RUNNER_H_ |
| OLD | NEW |