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_CONTROLLER_H_ | 5 #ifndef CONTENT_SHELL_WEBKIT_TEST_CONTROLLER_H_ |
6 #define CONTENT_SHELL_WEBKIT_TEST_CONTROLLER_H_ | 6 #define CONTENT_SHELL_WEBKIT_TEST_CONTROLLER_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/memory/scoped_ptr.h" |
13 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
14 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/non_thread_safe.h" |
15 #include "content/public/browser/render_view_host_observer.h" | 16 #include "content/public/browser/render_view_host_observer.h" |
16 #include "content/public/browser/web_contents_observer.h" | 17 #include "content/public/browser/web_contents_observer.h" |
17 #include "content/shell/shell_webpreferences.h" | |
18 | 18 |
19 class SkBitmap; | 19 class SkBitmap; |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 | 22 |
23 class Shell; | 23 class Shell; |
| 24 struct ShellWebPreferences; |
24 | 25 |
25 class WebKitTestResultPrinter { | 26 class WebKitTestResultPrinter { |
26 public: | 27 public: |
27 WebKitTestResultPrinter(std::ostream* output, std::ostream* error); | 28 WebKitTestResultPrinter(std::ostream* output, std::ostream* error); |
28 ~WebKitTestResultPrinter(); | 29 ~WebKitTestResultPrinter(); |
29 | 30 |
30 void reset() { | 31 void reset() { |
31 state_ = BEFORE_TEST; | 32 state_ = BEFORE_TEST; |
32 } | 33 } |
33 bool in_text_block() const { return state_ == IN_TEXT_BLOCK; } | 34 bool in_text_block() const { return state_ == IN_TEXT_BLOCK; } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 const std::string& expected_pixel_hash); | 80 const std::string& expected_pixel_hash); |
80 // True if the controller was reset successfully. | 81 // True if the controller was reset successfully. |
81 bool ResetAfterLayoutTest(); | 82 bool ResetAfterLayoutTest(); |
82 | 83 |
83 void RendererUnresponsive(); | 84 void RendererUnresponsive(); |
84 | 85 |
85 WebKitTestResultPrinter* printer() { return printer_.get(); } | 86 WebKitTestResultPrinter* printer() { return printer_.get(); } |
86 void set_printer(WebKitTestResultPrinter* printer) { | 87 void set_printer(WebKitTestResultPrinter* printer) { |
87 printer_.reset(printer); | 88 printer_.reset(printer); |
88 } | 89 } |
89 const ShellWebPreferences& web_preferences() const { return prefs_; } | 90 const ShellWebPreferences& web_preferences() const { return *prefs_.get(); } |
90 bool should_stay_on_page_after_handling_before_unload() const { | 91 bool should_stay_on_page_after_handling_before_unload() const { |
91 return should_stay_on_page_after_handling_before_unload_; | 92 return should_stay_on_page_after_handling_before_unload_; |
92 } | 93 } |
93 | 94 |
94 // This method can be invoked on any thread. | 95 // This method can be invoked on any thread. |
95 bool CanOpenWindows() const; | 96 bool CanOpenWindows() const; |
96 | 97 |
97 // WebContentsObserver implementation. | 98 // WebContentsObserver implementation. |
98 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 99 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
99 virtual void PluginCrashed(const FilePath& plugin_path) OVERRIDE; | 100 virtual void PluginCrashed(const FilePath& plugin_path) OVERRIDE; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 bool enable_pixel_dumping_; | 139 bool enable_pixel_dumping_; |
139 std::string expected_pixel_hash_; | 140 std::string expected_pixel_hash_; |
140 | 141 |
141 bool captured_dump_; | 142 bool captured_dump_; |
142 | 143 |
143 bool dump_as_text_; | 144 bool dump_as_text_; |
144 bool dump_child_frames_; | 145 bool dump_child_frames_; |
145 bool is_printing_; | 146 bool is_printing_; |
146 bool should_stay_on_page_after_handling_before_unload_; | 147 bool should_stay_on_page_after_handling_before_unload_; |
147 bool wait_until_done_; | 148 bool wait_until_done_; |
148 ShellWebPreferences prefs_; | 149 // TODO(jochen): Once we remove layout tests from content_browsertests, make |
| 150 // this a member instead of a scoped_ptr. |
| 151 scoped_ptr<ShellWebPreferences> prefs_; |
149 | 152 |
150 base::CancelableClosure watchdog_; | 153 base::CancelableClosure watchdog_; |
151 | 154 |
152 // Access to the following variables needs to be guarded by |lock_|. | 155 // Access to the following variables needs to be guarded by |lock_|. |
153 mutable base::Lock lock_; | 156 mutable base::Lock lock_; |
154 bool can_open_windows_; | 157 bool can_open_windows_; |
155 | 158 |
156 DISALLOW_COPY_AND_ASSIGN(WebKitTestController); | 159 DISALLOW_COPY_AND_ASSIGN(WebKitTestController); |
157 }; | 160 }; |
158 | 161 |
159 } // namespace content | 162 } // namespace content |
160 | 163 |
161 #endif // CONTENT_SHELL_WEBKIT_TEST_CONTROLLER_H_ | 164 #endif // CONTENT_SHELL_WEBKIT_TEST_CONTROLLER_H_ |
OLD | NEW |