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 17 matching lines...) Expand all Loading... |
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; | 37 virtual void DidFinishLoad(WebKit::WebFrame* frame) OVERRIDE; |
38 virtual void DidRequestShowContextMenu( | |
39 WebKit::WebFrame* frame, | |
40 const WebKit::WebContextMenuData& data) OVERRIDE; | |
41 | 38 |
42 // WebTestDelegate implementation. | 39 // WebTestDelegate implementation. |
43 virtual void clearContextMenuData(); | |
44 virtual void clearEditCommand(); | 40 virtual void clearEditCommand(); |
45 virtual void fillSpellingSuggestionList( | |
46 const WebKit::WebString& word, | |
47 WebKit::WebVector<WebKit::WebString>* suggestions); | |
48 virtual void setEditCommand(const std::string& name, | 41 virtual void setEditCommand(const std::string& name, |
49 const std::string& value); | 42 const std::string& value); |
50 virtual WebKit::WebContextMenuData* lastContextMenuData() const; | |
51 virtual void setGamepadData(const WebKit::WebGamepads& gamepads); | 43 virtual void setGamepadData(const WebKit::WebGamepads& gamepads); |
52 virtual void printMessage(const std::string& message); | 44 virtual void printMessage(const std::string& message); |
53 virtual void postTask(::WebTestRunner::WebTask* task); | 45 virtual void postTask(::WebTestRunner::WebTask* task); |
54 virtual void postDelayedTask(::WebTestRunner::WebTask* task, | 46 virtual void postDelayedTask(::WebTestRunner::WebTask* task, |
55 long long ms); | 47 long long ms); |
56 virtual WebKit::WebString registerIsolatedFileSystem( | 48 virtual WebKit::WebString registerIsolatedFileSystem( |
57 const WebKit::WebVector<WebKit::WebString>& absolute_filenames); | 49 const WebKit::WebVector<WebKit::WebString>& absolute_filenames); |
58 virtual long long getCurrentTimeInMillisecond(); | 50 virtual long long getCurrentTimeInMillisecond(); |
59 virtual WebKit::WebString getAbsoluteWebStringFromUTF8Path( | 51 virtual WebKit::WebString getAbsoluteWebStringFromUTF8Path( |
60 const std::string& utf8_path); | 52 const std::string& utf8_path); |
61 virtual WebKit::WebURL localFileToDataURL(const WebKit::WebURL& file_url); | 53 virtual WebKit::WebURL localFileToDataURL(const WebKit::WebURL& file_url); |
62 virtual WebKit::WebURL rewriteLayoutTestsURL(const std::string& utf8_url); | 54 virtual WebKit::WebURL rewriteLayoutTestsURL(const std::string& utf8_url); |
63 virtual ::WebTestRunner::WebPreferences* preferences(); | 55 virtual ::WebTestRunner::WebPreferences* preferences(); |
64 virtual void applyPreferences(); | 56 virtual void applyPreferences(); |
65 virtual std::string makeURLErrorDescription(const WebKit::WebURLError& error); | 57 virtual std::string makeURLErrorDescription(const WebKit::WebURLError& error); |
| 58 virtual void setClientWindowRect(const WebKit::WebRect& rect); |
| 59 virtual void showDevTools(); |
| 60 virtual void closeDevTools(); |
| 61 virtual void evaluateInWebInspector(long call_id, const std::string& script); |
| 62 virtual void clearAllDatabases(); |
| 63 virtual void setDatabaseQuota(int quota); |
| 64 virtual void setDeviceScaleFactor(float factor); |
| 65 virtual void setFocus(bool focus); |
| 66 virtual void setAcceptAllCookies(bool accept); |
| 67 virtual std::string pathToLocalResource(const std::string& resource); |
| 68 virtual void setLocale(const std::string& locale); |
| 69 virtual void setDeviceOrientation(WebKit::WebDeviceOrientation& orientation); |
| 70 virtual void didAcquirePointerLock(); |
| 71 virtual void didNotAcquirePointerLock(); |
| 72 virtual void didLosePointerLock(); |
| 73 virtual void setPointerLockWillRespondAsynchronously(); |
| 74 virtual void setPointerLockWillFailSynchronously(); |
| 75 virtual int numberOfPendingGeolocationPermissionRequests(); |
| 76 virtual void setGeolocationPermission(bool allowed); |
| 77 virtual void setMockGeolocationPosition(double longitude, |
| 78 double latitude, |
| 79 double precision); |
| 80 virtual void setMockGeolocationPositionUnavailableError( |
| 81 const std::string& message); |
| 82 virtual void addMockSpeechInputResult(const std::string& result, |
| 83 double confidence, |
| 84 const std::string& language); |
| 85 virtual void setMockSpeechInputDumpRect(bool dump_rect); |
| 86 virtual void addMockSpeechRecognitionResult(const std::string& transcript, |
| 87 double confidence); |
| 88 virtual void setMockSpeechRecognitionError(const std::string& error, |
| 89 const std::string& message); |
| 90 virtual bool wasMockSpeechRecognitionAborted(); |
| 91 virtual void testFinished(); |
| 92 virtual void testTimedOut(); |
| 93 virtual bool isBeingDebugged(); |
| 94 virtual int layoutTestTimeout(); |
| 95 virtual void closeRemainingWindows(); |
| 96 virtual int navigationEntryCount(); |
| 97 virtual int windowCount(); |
| 98 virtual void goToOffset(int offset); |
| 99 virtual void reload(); |
| 100 virtual void loadURLForFrame(const WebKit::WebURL& url, |
| 101 const std::string& frame_name); |
| 102 virtual bool allowExternalPages(); |
| 103 virtual void captureHistoryForWindow( |
| 104 size_t windowIndex, |
| 105 WebKit::WebVector<WebKit::WebHistoryItem>* history, |
| 106 size_t* currentEntryIndex); |
66 | 107 |
67 void Reset(); | 108 void Reset(); |
68 void NotifyDone(); | 109 void NotifyDone(); |
69 void DumpAsText(); | 110 void DumpAsText(); |
70 void DumpChildFramesAsText(); | 111 void DumpChildFramesAsText(); |
71 void WaitUntilDone(); | 112 void WaitUntilDone(); |
72 void OverridePreference(const std::string& key, v8::Local<v8::Value> value); | 113 void OverridePreference(const std::string& key, v8::Local<v8::Value> value); |
73 | 114 |
74 void NotImplemented(const std::string& object, const std::string& method); | 115 void NotImplemented(const std::string& object, const std::string& method); |
75 | 116 |
76 void set_proxy(::WebTestRunner::WebTestProxyBase* proxy) { proxy_ = proxy; } | 117 void set_proxy(::WebTestRunner::WebTestProxyBase* proxy) { proxy_ = proxy; } |
77 | 118 |
78 private: | 119 private: |
79 // Message handlers. | 120 // Message handlers. |
80 void OnSetTestConfiguration( | 121 void OnSetTestConfiguration( |
81 const base::FilePath& current_working_directory, | 122 const base::FilePath& current_working_directory, |
82 bool enable_pixel_dumping, | 123 bool enable_pixel_dumping, |
83 int layout_test_timeout, | 124 int layout_test_timeout, |
84 bool allow_external_pages, | 125 bool allow_external_pages, |
85 const std::string& expected_pixel_hash); | 126 const std::string& expected_pixel_hash); |
86 | 127 |
87 void CaptureDump(); | 128 void CaptureDump(); |
88 void CaptureTextDump(); | 129 void CaptureTextDump(); |
89 void CaptureImageDump(); | 130 void CaptureImageDump(); |
90 | 131 |
91 scoped_ptr<WebKit::WebContextMenuData> last_context_menu_data_; | 132 static int window_count_; |
| 133 |
92 base::FilePath current_working_directory_; | 134 base::FilePath current_working_directory_; |
93 | 135 |
94 ::WebTestRunner::WebTestProxyBase* proxy_; | 136 ::WebTestRunner::WebTestProxyBase* proxy_; |
95 | 137 |
96 ::WebTestRunner::WebPreferences prefs_; | 138 ::WebTestRunner::WebPreferences prefs_; |
97 | 139 |
98 bool test_is_running_; | 140 bool test_is_running_; |
99 bool wait_until_done_; | 141 bool wait_until_done_; |
100 bool load_finished_; | 142 bool load_finished_; |
101 bool dump_as_text_; | 143 bool dump_as_text_; |
102 bool dump_child_frames_as_text_; | 144 bool dump_child_frames_as_text_; |
103 bool printing_; | 145 bool printing_; |
104 | 146 |
105 bool enable_pixel_dumping_; | 147 bool enable_pixel_dumping_; |
106 int layout_test_timeout_; | 148 int layout_test_timeout_; |
107 bool allow_external_pages_; | 149 bool allow_external_pages_; |
108 std::string expected_pixel_hash_; | 150 std::string expected_pixel_hash_; |
109 | 151 |
110 DISALLOW_COPY_AND_ASSIGN(WebKitTestRunner); | 152 DISALLOW_COPY_AND_ASSIGN(WebKitTestRunner); |
111 }; | 153 }; |
112 | 154 |
113 } // namespace content | 155 } // namespace content |
114 | 156 |
115 #endif // CONTENT_SHELL_WEBKIT_TEST_RUNNER_H_ | 157 #endif // CONTENT_SHELL_WEBKIT_TEST_RUNNER_H_ |
OLD | NEW |