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_WEBKIT_TEST_RUNNER_HOST_H_ | 5 #ifndef CONTENT_SHELL_WEBKIT_TEST_RUNNER_HOST_H_ |
6 #define CONTENT_SHELL_WEBKIT_TEST_RUNNER_HOST_H_ | 6 #define CONTENT_SHELL_WEBKIT_TEST_RUNNER_HOST_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/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.h" |
14 #include "content/public/browser/render_view_host_observer.h" | 14 #include "content/public/browser/render_view_host_observer.h" |
15 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
| 16 #include "content/shell/shell_webpreferences.h" |
16 | 17 |
17 class SkBitmap; | 18 class SkBitmap; |
18 | 19 |
19 namespace content { | 20 namespace content { |
20 | 21 |
21 class Shell; | 22 class Shell; |
22 | 23 |
23 class WebKitTestResultPrinter { | 24 class WebKitTestResultPrinter { |
24 public: | 25 public: |
25 WebKitTestResultPrinter(std::ostream* output, std::ostream* error); | 26 WebKitTestResultPrinter(std::ostream* output, std::ostream* error); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 const std::string& expected_pixel_hash); | 78 const std::string& expected_pixel_hash); |
78 // True if the controller was reset successfully. | 79 // True if the controller was reset successfully. |
79 bool ResetAfterLayoutTest(); | 80 bool ResetAfterLayoutTest(); |
80 | 81 |
81 void RendererUnresponsive(); | 82 void RendererUnresponsive(); |
82 | 83 |
83 WebKitTestResultPrinter* printer() { return printer_.get(); } | 84 WebKitTestResultPrinter* printer() { return printer_.get(); } |
84 void set_printer(WebKitTestResultPrinter* printer) { | 85 void set_printer(WebKitTestResultPrinter* printer) { |
85 printer_.reset(printer); | 86 printer_.reset(printer); |
86 } | 87 } |
| 88 const ShellWebPreferences& web_preferences() const { return prefs_; } |
87 | 89 |
88 // Interface for WebKitTestRunnerHost. | 90 // Interface for WebKitTestRunnerHost. |
89 void NotifyDone(); | 91 void NotifyDone(); |
90 void WaitUntilDone(); | 92 void WaitUntilDone(); |
91 void NotImplemented(const std::string& object_name, | 93 void NotImplemented(const std::string& object_name, |
92 const std::string& method_name); | 94 const std::string& method_name); |
93 | 95 |
94 bool should_stay_on_page_after_handling_before_unload() const { | 96 bool should_stay_on_page_after_handling_before_unload() const { |
95 return should_stay_on_page_after_handling_before_unload_; | 97 return should_stay_on_page_after_handling_before_unload_; |
96 } | 98 } |
(...skipping 22 matching lines...) Expand all Loading... |
119 static WebKitTestController* instance_; | 121 static WebKitTestController* instance_; |
120 | 122 |
121 void CaptureDump(); | 123 void CaptureDump(); |
122 void TimeoutHandler(); | 124 void TimeoutHandler(); |
123 | 125 |
124 // Message handlers. | 126 // Message handlers. |
125 void OnDidFinishLoad(); | 127 void OnDidFinishLoad(); |
126 void OnImageDump(const std::string& actual_pixel_hash, const SkBitmap& image); | 128 void OnImageDump(const std::string& actual_pixel_hash, const SkBitmap& image); |
127 void OnTextDump(const std::string& dump); | 129 void OnTextDump(const std::string& dump); |
128 void OnPrintMessage(const std::string& message); | 130 void OnPrintMessage(const std::string& message); |
| 131 void OnOverridePreferences(const ShellWebPreferences& prefs); |
129 | 132 |
130 scoped_ptr<WebKitTestResultPrinter> printer_; | 133 scoped_ptr<WebKitTestResultPrinter> printer_; |
131 | 134 |
132 FilePath current_working_directory_; | 135 FilePath current_working_directory_; |
133 | 136 |
134 Shell* main_window_; | 137 Shell* main_window_; |
135 | 138 |
136 bool enable_pixel_dumping_; | 139 bool enable_pixel_dumping_; |
137 std::string expected_pixel_hash_; | 140 std::string expected_pixel_hash_; |
138 | 141 |
139 bool captured_dump_; | 142 bool captured_dump_; |
140 | 143 |
141 bool dump_as_text_; | 144 bool dump_as_text_; |
142 bool dump_child_frames_; | 145 bool dump_child_frames_; |
143 bool is_printing_; | 146 bool is_printing_; |
144 bool should_stay_on_page_after_handling_before_unload_; | 147 bool should_stay_on_page_after_handling_before_unload_; |
145 bool wait_until_done_; | 148 bool wait_until_done_; |
| 149 ShellWebPreferences prefs_; |
146 | 150 |
147 base::CancelableClosure watchdog_; | 151 base::CancelableClosure watchdog_; |
148 | 152 |
149 DISALLOW_COPY_AND_ASSIGN(WebKitTestController); | 153 DISALLOW_COPY_AND_ASSIGN(WebKitTestController); |
150 }; | 154 }; |
151 | 155 |
152 class WebKitTestRunnerHost : public RenderViewHostObserver { | 156 class WebKitTestRunnerHost : public RenderViewHostObserver { |
153 public: | 157 public: |
154 explicit WebKitTestRunnerHost(RenderViewHost* render_view_host); | 158 explicit WebKitTestRunnerHost(RenderViewHost* render_view_host); |
155 virtual ~WebKitTestRunnerHost(); | 159 virtual ~WebKitTestRunnerHost(); |
(...skipping 12 matching lines...) Expand all Loading... |
168 | 172 |
169 void OnNotImplemented(const std::string& object_name, | 173 void OnNotImplemented(const std::string& object_name, |
170 const std::string& method_name); | 174 const std::string& method_name); |
171 | 175 |
172 DISALLOW_COPY_AND_ASSIGN(WebKitTestRunnerHost); | 176 DISALLOW_COPY_AND_ASSIGN(WebKitTestRunnerHost); |
173 }; | 177 }; |
174 | 178 |
175 } // namespace content | 179 } // namespace content |
176 | 180 |
177 #endif // CONTENT_SHELL_WEBKIT_TEST_RUNNER_HOST_H_ | 181 #endif // CONTENT_SHELL_WEBKIT_TEST_RUNNER_HOST_H_ |
OLD | NEW |