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_H_ | 5 #ifndef CONTENT_SHELL_WEBKIT_TEST_RUNNER_H_ |
6 #define CONTENT_SHELL_WEBKIT_TEST_RUNNER_H_ | 6 #define CONTENT_SHELL_WEBKIT_TEST_RUNNER_H_ |
7 | 7 |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "content/public/renderer/render_view_observer.h" | 10 #include "content/public/renderer/render_view_observer.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 // This is the renderer side of the webkit test runner. | 27 // This is the renderer side of the webkit test runner. |
28 class WebKitTestRunner : public RenderViewObserver, | 28 class WebKitTestRunner : public RenderViewObserver, |
29 public WebTestRunner::WebTestDelegate { | 29 public WebTestRunner::WebTestDelegate { |
30 public: | 30 public: |
31 explicit WebKitTestRunner(RenderView* render_view); | 31 explicit WebKitTestRunner(RenderView* render_view); |
32 virtual ~WebKitTestRunner(); | 32 virtual ~WebKitTestRunner(); |
33 | 33 |
34 // RenderViewObserver implementation. | 34 // RenderViewObserver implementation. |
35 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 35 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
36 virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE; | 36 virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE; |
37 virtual void DidFinishLoad(WebKit::WebFrame* frame) OVERRIDE; | |
38 | 37 |
39 // WebTestDelegate implementation. | 38 // WebTestDelegate implementation. |
40 virtual void clearEditCommand(); | 39 virtual void clearEditCommand(); |
41 virtual void setEditCommand(const std::string& name, | 40 virtual void setEditCommand(const std::string& name, |
42 const std::string& value); | 41 const std::string& value); |
43 virtual void setGamepadData(const WebKit::WebGamepads& gamepads); | 42 virtual void setGamepadData(const WebKit::WebGamepads& gamepads); |
44 virtual void printMessage(const std::string& message); | 43 virtual void printMessage(const std::string& message); |
45 virtual void postTask(::WebTestRunner::WebTask* task); | 44 virtual void postTask(::WebTestRunner::WebTask* task); |
46 virtual void postDelayedTask(::WebTestRunner::WebTask* task, | 45 virtual void postDelayedTask(::WebTestRunner::WebTask* task, |
47 long long ms); | 46 long long ms); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 virtual void reload(); | 98 virtual void reload(); |
100 virtual void loadURLForFrame(const WebKit::WebURL& url, | 99 virtual void loadURLForFrame(const WebKit::WebURL& url, |
101 const std::string& frame_name); | 100 const std::string& frame_name); |
102 virtual bool allowExternalPages(); | 101 virtual bool allowExternalPages(); |
103 virtual void captureHistoryForWindow( | 102 virtual void captureHistoryForWindow( |
104 size_t windowIndex, | 103 size_t windowIndex, |
105 WebKit::WebVector<WebKit::WebHistoryItem>* history, | 104 WebKit::WebVector<WebKit::WebHistoryItem>* history, |
106 size_t* currentEntryIndex); | 105 size_t* currentEntryIndex); |
107 | 106 |
108 void Reset(); | 107 void Reset(); |
109 void NotifyDone(); | |
110 void DumpAsText(); | |
111 void DumpChildFramesAsText(); | |
112 void WaitUntilDone(); | |
113 void OverridePreference(const std::string& key, v8::Local<v8::Value> value); | |
114 | |
115 void NotImplemented(const std::string& object, const std::string& method); | |
116 | 108 |
117 void set_proxy(::WebTestRunner::WebTestProxyBase* proxy) { proxy_ = proxy; } | 109 void set_proxy(::WebTestRunner::WebTestProxyBase* proxy) { proxy_ = proxy; } |
| 110 ::WebTestRunner::WebTestProxyBase* proxy() const { return proxy_; } |
118 | 111 |
119 private: | 112 private: |
120 // Message handlers. | 113 // Message handlers. |
121 void OnSetTestConfiguration( | 114 void OnSetTestConfiguration( |
122 const base::FilePath& current_working_directory, | 115 const base::FilePath& current_working_directory, |
123 bool enable_pixel_dumping, | 116 bool enable_pixel_dumping, |
124 int layout_test_timeout, | 117 int layout_test_timeout, |
125 bool allow_external_pages, | 118 bool allow_external_pages, |
126 const std::string& expected_pixel_hash); | 119 const std::string& expected_pixel_hash); |
127 | 120 |
128 void CaptureDump(); | 121 void CaptureDump(); |
129 void CaptureTextDump(); | |
130 void CaptureImageDump(); | |
131 | 122 |
132 static int window_count_; | 123 static int window_count_; |
133 | 124 |
134 base::FilePath current_working_directory_; | 125 base::FilePath current_working_directory_; |
135 | 126 |
136 ::WebTestRunner::WebTestProxyBase* proxy_; | 127 ::WebTestRunner::WebTestProxyBase* proxy_; |
137 | 128 |
138 ::WebTestRunner::WebPreferences prefs_; | 129 ::WebTestRunner::WebPreferences prefs_; |
139 | 130 |
140 bool test_is_running_; | |
141 bool wait_until_done_; | |
142 bool load_finished_; | |
143 bool dump_as_text_; | |
144 bool dump_child_frames_as_text_; | |
145 bool printing_; | |
146 | |
147 bool enable_pixel_dumping_; | 131 bool enable_pixel_dumping_; |
148 int layout_test_timeout_; | 132 int layout_test_timeout_; |
149 bool allow_external_pages_; | 133 bool allow_external_pages_; |
150 std::string expected_pixel_hash_; | 134 std::string expected_pixel_hash_; |
151 | 135 |
| 136 bool is_main_window_; |
| 137 |
152 DISALLOW_COPY_AND_ASSIGN(WebKitTestRunner); | 138 DISALLOW_COPY_AND_ASSIGN(WebKitTestRunner); |
153 }; | 139 }; |
154 | 140 |
155 } // namespace content | 141 } // namespace content |
156 | 142 |
157 #endif // CONTENT_SHELL_WEBKIT_TEST_RUNNER_H_ | 143 #endif // CONTENT_SHELL_WEBKIT_TEST_RUNNER_H_ |
OLD | NEW |