| 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_WEBKIT_TEST_CONTROLLER_H_ | 5 #ifndef CONTENT_SHELL_BROWSER_WEBKIT_TEST_CONTROLLER_H_ |
| 6 #define CONTENT_SHELL_BROWSER_WEBKIT_TEST_CONTROLLER_H_ | 6 #define CONTENT_SHELL_BROWSER_WEBKIT_TEST_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <ostream> | 8 #include <ostream> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 class WebKitTestController : public base::NonThreadSafe, | 101 class WebKitTestController : public base::NonThreadSafe, |
| 102 public WebContentsObserver, | 102 public WebContentsObserver, |
| 103 public NotificationObserver, | 103 public NotificationObserver, |
| 104 public GpuDataManagerObserver { | 104 public GpuDataManagerObserver { |
| 105 public: | 105 public: |
| 106 static WebKitTestController* Get(); | 106 static WebKitTestController* Get(); |
| 107 | 107 |
| 108 WebKitTestController(); | 108 WebKitTestController(); |
| 109 virtual ~WebKitTestController(); | 109 ~WebKitTestController() override; |
| 110 | 110 |
| 111 // True if the controller is ready for testing. | 111 // True if the controller is ready for testing. |
| 112 bool PrepareForLayoutTest(const GURL& test_url, | 112 bool PrepareForLayoutTest(const GURL& test_url, |
| 113 const base::FilePath& current_working_directory, | 113 const base::FilePath& current_working_directory, |
| 114 bool enable_pixel_dumping, | 114 bool enable_pixel_dumping, |
| 115 const std::string& expected_pixel_hash); | 115 const std::string& expected_pixel_hash); |
| 116 // True if the controller was reset successfully. | 116 // True if the controller was reset successfully. |
| 117 bool ResetAfterLayoutTest(); | 117 bool ResetAfterLayoutTest(); |
| 118 | 118 |
| 119 void SetTempPath(const base::FilePath& temp_path); | 119 void SetTempPath(const base::FilePath& temp_path); |
| 120 void RendererUnresponsive(); | 120 void RendererUnresponsive(); |
| 121 void WorkerCrashed(); | 121 void WorkerCrashed(); |
| 122 void OverrideWebkitPrefs(WebPreferences* prefs); | 122 void OverrideWebkitPrefs(WebPreferences* prefs); |
| 123 void OpenURL(const GURL& url); | 123 void OpenURL(const GURL& url); |
| 124 void TestFinishedInSecondaryWindow(); | 124 void TestFinishedInSecondaryWindow(); |
| 125 bool IsMainWindow(WebContents* web_contents) const; | 125 bool IsMainWindow(WebContents* web_contents) const; |
| 126 | 126 |
| 127 WebKitTestResultPrinter* printer() { return printer_.get(); } | 127 WebKitTestResultPrinter* printer() { return printer_.get(); } |
| 128 void set_printer(WebKitTestResultPrinter* printer) { | 128 void set_printer(WebKitTestResultPrinter* printer) { |
| 129 printer_.reset(printer); | 129 printer_.reset(printer); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void DevToolsProcessCrashed(); | 132 void DevToolsProcessCrashed(); |
| 133 | 133 |
| 134 // WebContentsObserver implementation. | 134 // WebContentsObserver implementation. |
| 135 virtual bool OnMessageReceived(const IPC::Message& message) override; | 135 bool OnMessageReceived(const IPC::Message& message) override; |
| 136 virtual void PluginCrashed(const base::FilePath& plugin_path, | 136 void PluginCrashed(const base::FilePath& plugin_path, |
| 137 base::ProcessId plugin_pid) override; | 137 base::ProcessId plugin_pid) override; |
| 138 virtual void RenderViewCreated(RenderViewHost* render_view_host) override; | 138 void RenderViewCreated(RenderViewHost* render_view_host) override; |
| 139 virtual void RenderProcessGone(base::TerminationStatus status) override; | 139 void RenderProcessGone(base::TerminationStatus status) override; |
| 140 virtual void WebContentsDestroyed() override; | 140 void WebContentsDestroyed() override; |
| 141 | 141 |
| 142 // NotificationObserver implementation. | 142 // NotificationObserver implementation. |
| 143 virtual void Observe(int type, | 143 void Observe(int type, |
| 144 const NotificationSource& source, | 144 const NotificationSource& source, |
| 145 const NotificationDetails& details) override; | 145 const NotificationDetails& details) override; |
| 146 | 146 |
| 147 // GpuDataManagerObserver implementation. | 147 // GpuDataManagerObserver implementation. |
| 148 virtual void OnGpuProcessCrashed(base::TerminationStatus exit_code) override; | 148 void OnGpuProcessCrashed(base::TerminationStatus exit_code) override; |
| 149 | 149 |
| 150 private: | 150 private: |
| 151 enum TestPhase { | 151 enum TestPhase { |
| 152 BETWEEN_TESTS, | 152 BETWEEN_TESTS, |
| 153 DURING_TEST, | 153 DURING_TEST, |
| 154 CLEAN_UP | 154 CLEAN_UP |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 static WebKitTestController* instance_; | 157 static WebKitTestController* instance_; |
| 158 | 158 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 // waiting on the UI thread while layout tests are being ran. | 219 // waiting on the UI thread while layout tests are being ran. |
| 220 ScopedAllowWaitForAndroidLayoutTests reduced_restrictions_; | 220 ScopedAllowWaitForAndroidLayoutTests reduced_restrictions_; |
| 221 #endif | 221 #endif |
| 222 | 222 |
| 223 DISALLOW_COPY_AND_ASSIGN(WebKitTestController); | 223 DISALLOW_COPY_AND_ASSIGN(WebKitTestController); |
| 224 }; | 224 }; |
| 225 | 225 |
| 226 } // namespace content | 226 } // namespace content |
| 227 | 227 |
| 228 #endif // CONTENT_SHELL_BROWSER_WEBKIT_TEST_CONTROLLER_H_ | 228 #endif // CONTENT_SHELL_BROWSER_WEBKIT_TEST_CONTROLLER_H_ |
| OLD | NEW |