[email protected] | 31d71b0 | 2012-01-26 03:42:31 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | 9b4c6cd | 2012-08-20 10:47:45 | [diff] [blame] | 5 | #include "content/shell/webkit_test_runner.h" |
[email protected] | 31d71b0 | 2012-01-26 03:42:31 | [diff] [blame] | 6 | |
[email protected] | 0c5f222 | 2013-02-20 11:26:19 | [diff] [blame] | 7 | #include <algorithm> |
[email protected] | 833b700d | 2013-02-18 19:43:00 | [diff] [blame] | 8 | #include <clocale> |
[email protected] | b9fad24c | 2012-11-15 08:22:10 | [diff] [blame] | 9 | #include <cmath> |
| 10 | |
[email protected] | 09ec9f9 | 2012-12-17 09:46:36 | [diff] [blame] | 11 | #include "base/base64.h" |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 12 | #include "base/debug/debugger.h" |
[email protected] | 0799da0 | 2012-06-27 10:58:51 | [diff] [blame] | 13 | #include "base/md5.h" |
[email protected] | e225b92 | 2012-08-18 01:43:04 | [diff] [blame] | 14 | #include "base/memory/scoped_ptr.h" |
[email protected] | b2324b09 | 2012-11-01 10:34:11 | [diff] [blame] | 15 | #include "base/message_loop.h" |
[email protected] | 0c5f222 | 2013-02-20 11:26:19 | [diff] [blame] | 16 | #include "base/string_util.h" |
[email protected] | c272c5b | 2012-06-06 09:01:06 | [diff] [blame] | 17 | #include "base/stringprintf.h" |
[email protected] | 0d2dfb92d | 2012-11-05 10:26:45 | [diff] [blame] | 18 | #include "base/sys_string_conversions.h" |
[email protected] | b2324b09 | 2012-11-01 10:34:11 | [diff] [blame] | 19 | #include "base/time.h" |
[email protected] | 0d2dfb92d | 2012-11-05 10:26:45 | [diff] [blame] | 20 | #include "base/utf_string_conversions.h" |
[email protected] | efb5f57 | 2012-01-29 10:57:33 | [diff] [blame] | 21 | #include "content/public/renderer/render_view.h" |
[email protected] | f322356c | 2013-03-01 07:54:02 | [diff] [blame] | 22 | #include "content/public/renderer/render_view_visitor.h" |
[email protected] | e519692 | 2012-12-11 22:18:25 | [diff] [blame] | 23 | #include "content/public/test/layouttest_support.h" |
[email protected] | efb5f57 | 2012-01-29 10:57:33 | [diff] [blame] | 24 | #include "content/shell/shell_messages.h" |
[email protected] | b2324b09 | 2012-11-01 10:34:11 | [diff] [blame] | 25 | #include "content/shell/shell_render_process_observer.h" |
[email protected] | 55915a7 | 2012-12-18 11:55:25 | [diff] [blame] | 26 | #include "content/shell/webkit_test_helpers.h" |
[email protected] | 9d9ec98 | 2013-01-10 18:53:39 | [diff] [blame] | 27 | #include "net/base/net_errors.h" |
[email protected] | 0d2dfb92d | 2012-11-05 10:26:45 | [diff] [blame] | 28 | #include "net/base/net_util.h" |
[email protected] | 0799da0 | 2012-06-27 10:58:51 | [diff] [blame] | 29 | #include "skia/ext/platform_canvas.h" |
[email protected] | 2a58eb1 | 2012-12-18 07:56:40 | [diff] [blame] | 30 | #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h" |
[email protected] | 87884c4 | 2013-01-10 01:56:27 | [diff] [blame] | 31 | #include "third_party/WebKit/Source/Platform/chromium/public/WebCString.h" |
| 32 | #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" |
| 33 | #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
| 34 | #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" |
| 35 | #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" |
[email protected] | 9d9ec98 | 2013-01-10 18:53:39 | [diff] [blame] | 36 | #include "third_party/WebKit/Source/Platform/chromium/public/WebURLError.h" |
[email protected] | 0ac1a03 | 2013-02-12 12:53:37 | [diff] [blame] | 37 | #include "third_party/WebKit/Source/Platform/chromium/public/WebURLResponse.h" |
[email protected] | 893fc636 | 2013-02-18 13:24:05 | [diff] [blame] | 38 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebArrayBufferView.h" |
[email protected] | b2324b09 | 2012-11-01 10:34:11 | [diff] [blame] | 39 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" |
[email protected] | 0ac1a03 | 2013-02-12 12:53:37 | [diff] [blame] | 40 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" |
[email protected] | 001841c9 | 2012-12-11 17:00:13 | [diff] [blame] | 41 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgent.h" |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 42 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebDeviceOrientation.h" |
[email protected] | efb5f57 | 2012-01-29 10:57:33 | [diff] [blame] | 43 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 44 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
| 45 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
[email protected] | 8f72269 | 2013-02-23 14:14:06 | [diff] [blame] | 46 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" |
[email protected] | b2324b09 | 2012-11-01 10:34:11 | [diff] [blame] | 47 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
[email protected] | 0bfe175 | 2013-03-07 08:44:26 | [diff] [blame] | 48 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebTestingSupport.h" |
[email protected] | efb5f57 | 2012-01-29 10:57:33 | [diff] [blame] | 49 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
[email protected] | b2324b09 | 2012-11-01 10:34:11 | [diff] [blame] | 50 | #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/WebTask.h" |
[email protected] | 5f20df36 | 2013-02-15 19:48:19 | [diff] [blame] | 51 | #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestInterfaces.h" |
[email protected] | b9fad24c | 2012-11-15 08:22:10 | [diff] [blame] | 52 | #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h" |
[email protected] | 5f20df36 | 2013-02-15 19:48:19 | [diff] [blame] | 53 | #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h" |
[email protected] | c24b4022 | 2013-02-20 11:45:42 | [diff] [blame] | 54 | #include "ui/gfx/rect.h" |
[email protected] | 984a5f7 | 2012-12-13 21:41:50 | [diff] [blame] | 55 | #include "webkit/base/file_path_string_conversions.h" |
[email protected] | 8f72269 | 2013-02-23 14:14:06 | [diff] [blame] | 56 | #include "webkit/glue/glue_serialize.h" |
[email protected] | 0799da0 | 2012-06-27 10:58:51 | [diff] [blame] | 57 | #include "webkit/glue/webkit_glue.h" |
[email protected] | 324825d | 2012-11-30 12:37:15 | [diff] [blame] | 58 | #include "webkit/glue/webpreferences.h" |
[email protected] | efb5f57 | 2012-01-29 10:57:33 | [diff] [blame] | 59 | |
[email protected] | 2a58eb1 | 2012-12-18 07:56:40 | [diff] [blame] | 60 | using WebKit::Platform; |
[email protected] | 893fc636 | 2013-02-18 13:24:05 | [diff] [blame] | 61 | using WebKit::WebArrayBufferView; |
[email protected] | b2324b09 | 2012-11-01 10:34:11 | [diff] [blame] | 62 | using WebKit::WebContextMenuData; |
[email protected] | 001841c9 | 2012-12-11 17:00:13 | [diff] [blame] | 63 | using WebKit::WebDevToolsAgent; |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 64 | using WebKit::WebDeviceOrientation; |
[email protected] | efb5f57 | 2012-01-29 10:57:33 | [diff] [blame] | 65 | using WebKit::WebElement; |
[email protected] | b2324b09 | 2012-11-01 10:34:11 | [diff] [blame] | 66 | using WebKit::WebFrame; |
| 67 | using WebKit::WebGamepads; |
[email protected] | 8f72269 | 2013-02-23 14:14:06 | [diff] [blame] | 68 | using WebKit::WebHistoryItem; |
[email protected] | 0799da0 | 2012-06-27 10:58:51 | [diff] [blame] | 69 | using WebKit::WebRect; |
[email protected] | c272c5b | 2012-06-06 09:01:06 | [diff] [blame] | 70 | using WebKit::WebSize; |
[email protected] | b2324b09 | 2012-11-01 10:34:11 | [diff] [blame] | 71 | using WebKit::WebString; |
[email protected] | 0bfe175 | 2013-03-07 08:44:26 | [diff] [blame] | 72 | using WebKit::WebTestingSupport; |
[email protected] | 09ec9f9 | 2012-12-17 09:46:36 | [diff] [blame] | 73 | using WebKit::WebURL; |
[email protected] | 9d9ec98 | 2013-01-10 18:53:39 | [diff] [blame] | 74 | using WebKit::WebURLError; |
[email protected] | b2324b09 | 2012-11-01 10:34:11 | [diff] [blame] | 75 | using WebKit::WebVector; |
[email protected] | 0799da0 | 2012-06-27 10:58:51 | [diff] [blame] | 76 | using WebKit::WebView; |
[email protected] | b3dbcb5e | 2012-12-17 00:16:37 | [diff] [blame] | 77 | using WebTestRunner::WebPreferences; |
[email protected] | b2324b09 | 2012-11-01 10:34:11 | [diff] [blame] | 78 | using WebTestRunner::WebTask; |
[email protected] | 5f20df36 | 2013-02-15 19:48:19 | [diff] [blame] | 79 | using WebTestRunner::WebTestInterfaces; |
[email protected] | 9063bf6 | 2013-02-20 19:42:01 | [diff] [blame] | 80 | using WebTestRunner::WebTestProxyBase; |
[email protected] | efb5f57 | 2012-01-29 10:57:33 | [diff] [blame] | 81 | |
[email protected] | 31d71b0 | 2012-01-26 03:42:31 | [diff] [blame] | 82 | namespace content { |
| 83 | |
[email protected] | efb5f57 | 2012-01-29 10:57:33 | [diff] [blame] | 84 | namespace { |
| 85 | |
[email protected] | b2324b09 | 2012-11-01 10:34:11 | [diff] [blame] | 86 | void InvokeTaskHelper(void* context) { |
| 87 | WebTask* task = reinterpret_cast<WebTask*>(context); |
| 88 | task->run(); |
| 89 | delete task; |
| 90 | } |
| 91 | |
[email protected] | 0799da0 | 2012-06-27 10:58:51 | [diff] [blame] | 92 | #if !defined(OS_MACOSX) |
| 93 | void MakeBitmapOpaque(SkBitmap* bitmap) { |
| 94 | SkAutoLockPixels lock(*bitmap); |
| 95 | DCHECK(bitmap->config() == SkBitmap::kARGB_8888_Config); |
| 96 | for (int y = 0; y < bitmap->height(); ++y) { |
| 97 | uint32_t* row = bitmap->getAddr32(0, y); |
| 98 | for (int x = 0; x < bitmap->width(); ++x) |
| 99 | row[x] |= 0xFF000000; // Set alpha bits to 1. |
| 100 | } |
| 101 | } |
| 102 | #endif |
| 103 | |
[email protected] | b9fad24c | 2012-11-15 08:22:10 | [diff] [blame] | 104 | void CopyCanvasToBitmap(SkCanvas* canvas, SkBitmap* snapshot) { |
[email protected] | 9d611ca | 2012-11-14 13:46:56 | [diff] [blame] | 105 | SkDevice* device = skia::GetTopDevice(*canvas); |
[email protected] | 0799da0 | 2012-06-27 10:58:51 | [diff] [blame] | 106 | const SkBitmap& bitmap = device->accessBitmap(false); |
| 107 | bitmap.copyTo(snapshot, SkBitmap::kARGB_8888_Config); |
| 108 | |
| 109 | #if !defined(OS_MACOSX) |
| 110 | // Only the expected PNGs for Mac have a valid alpha channel. |
| 111 | MakeBitmapOpaque(snapshot); |
| 112 | #endif |
| 113 | |
| 114 | } |
| 115 | |
[email protected] | f322356c | 2013-03-01 07:54:02 | [diff] [blame] | 116 | class SyncNavigationStateVisitor : public RenderViewVisitor { |
| 117 | public: |
| 118 | SyncNavigationStateVisitor() {} |
| 119 | virtual ~SyncNavigationStateVisitor() {} |
| 120 | |
| 121 | virtual bool Visit(RenderView* render_view) OVERRIDE { |
| 122 | SyncNavigationState(render_view); |
| 123 | return true; |
| 124 | } |
| 125 | private: |
| 126 | DISALLOW_COPY_AND_ASSIGN(SyncNavigationStateVisitor); |
| 127 | }; |
| 128 | |
[email protected] | 95026a0 | 2013-03-05 08:34:30 | [diff] [blame] | 129 | class ProxyToRenderViewVisitor : public RenderViewVisitor { |
| 130 | public: |
| 131 | explicit ProxyToRenderViewVisitor(WebTestProxyBase* proxy) |
| 132 | : proxy_(proxy), |
| 133 | render_view_(NULL) { |
| 134 | } |
| 135 | virtual ~ProxyToRenderViewVisitor() {} |
| 136 | |
| 137 | RenderView* render_view() const { return render_view_; } |
| 138 | |
| 139 | virtual bool Visit(RenderView* render_view) OVERRIDE { |
| 140 | WebKitTestRunner* test_runner = WebKitTestRunner::Get(render_view); |
| 141 | if (!test_runner) { |
| 142 | NOTREACHED(); |
| 143 | return true; |
| 144 | } |
| 145 | if (test_runner->proxy() == proxy_) { |
| 146 | render_view_ = render_view; |
| 147 | return false; |
| 148 | } |
| 149 | return true; |
| 150 | } |
| 151 | private: |
| 152 | WebTestProxyBase* proxy_; |
| 153 | RenderView* render_view_; |
| 154 | |
| 155 | DISALLOW_COPY_AND_ASSIGN(ProxyToRenderViewVisitor); |
| 156 | }; |
| 157 | |
[email protected] | efb5f57 | 2012-01-29 10:57:33 | [diff] [blame] | 158 | } // namespace |
[email protected] | cccb5cf | 2012-06-06 22:20:04 | [diff] [blame] | 159 | |
[email protected] | 9b4c6cd | 2012-08-20 10:47:45 | [diff] [blame] | 160 | WebKitTestRunner::WebKitTestRunner(RenderView* render_view) |
[email protected] | 5f20df36 | 2013-02-15 19:48:19 | [diff] [blame] | 161 | : RenderViewObserver(render_view), |
[email protected] | 2025a2f4 | 2013-02-18 07:25:41 | [diff] [blame] | 162 | RenderViewObserverTracker<WebKitTestRunner>(render_view), |
[email protected] | ab683b2 | 2013-03-04 09:10:31 | [diff] [blame] | 163 | proxy_(NULL), |
[email protected] | 95026a0 | 2013-03-05 08:34:30 | [diff] [blame] | 164 | focused_view_(NULL), |
[email protected] | 0bfe175 | 2013-03-07 08:44:26 | [diff] [blame] | 165 | is_main_window_(false), |
| 166 | reset_on_next_navigation_(false), |
| 167 | test_is_running_(false) { |
[email protected] | 31d71b0 | 2012-01-26 03:42:31 | [diff] [blame] | 168 | } |
| 169 | |
[email protected] | 9b4c6cd | 2012-08-20 10:47:45 | [diff] [blame] | 170 | WebKitTestRunner::~WebKitTestRunner() { |
[email protected] | 31d71b0 | 2012-01-26 03:42:31 | [diff] [blame] | 171 | } |
| 172 | |
[email protected] | b2324b09 | 2012-11-01 10:34:11 | [diff] [blame] | 173 | // WebTestDelegate ----------------------------------------------------------- |
| 174 | |
[email protected] | b2324b09 | 2012-11-01 10:34:11 | [diff] [blame] | 175 | void WebKitTestRunner::clearEditCommand() { |
| 176 | render_view()->ClearEditCommands(); |
| 177 | } |
| 178 | |
| 179 | void WebKitTestRunner::setEditCommand(const std::string& name, |
| 180 | const std::string& value) { |
| 181 | render_view()->SetEditCommandForNextKeyEvent(name, value); |
| 182 | } |
| 183 | |
[email protected] | b2324b09 | 2012-11-01 10:34:11 | [diff] [blame] | 184 | void WebKitTestRunner::setGamepadData(const WebGamepads& gamepads) { |
[email protected] | e519692 | 2012-12-11 22:18:25 | [diff] [blame] | 185 | SetMockGamepads(gamepads); |
[email protected] | b2324b09 | 2012-11-01 10:34:11 | [diff] [blame] | 186 | } |
| 187 | |
| 188 | void WebKitTestRunner::printMessage(const std::string& message) { |
| 189 | Send(new ShellViewHostMsg_PrintMessage(routing_id(), message)); |
| 190 | } |
| 191 | |
| 192 | void WebKitTestRunner::postTask(WebTask* task) { |
[email protected] | 2a58eb1 | 2012-12-18 07:56:40 | [diff] [blame] | 193 | Platform::current()->callOnMainThread(InvokeTaskHelper, task); |
[email protected] | b2324b09 | 2012-11-01 10:34:11 | [diff] [blame] | 194 | } |
| 195 | |
| 196 | void WebKitTestRunner::postDelayedTask(WebTask* task, long long ms) { |
| 197 | MessageLoop::current()->PostDelayedTask( |
| 198 | FROM_HERE, |
| 199 | base::Bind(&WebTask::run, base::Owned(task)), |
| 200 | base::TimeDelta::FromMilliseconds(ms)); |
| 201 | } |
| 202 | |
| 203 | WebString WebKitTestRunner::registerIsolatedFileSystem( |
| 204 | const WebKit::WebVector<WebKit::WebString>& absolute_filenames) { |
[email protected] | d30a36f | 2013-02-07 04:16:26 | [diff] [blame] | 205 | std::vector<base::FilePath> files; |
[email protected] | 984a5f7 | 2012-12-13 21:41:50 | [diff] [blame] | 206 | for (size_t i = 0; i < absolute_filenames.size(); ++i) |
| 207 | files.push_back(webkit_base::WebStringToFilePath(absolute_filenames[i])); |
| 208 | std::string filesystem_id; |
| 209 | Send(new ShellViewHostMsg_RegisterIsolatedFileSystem( |
| 210 | routing_id(), files, &filesystem_id)); |
| 211 | return WebString::fromUTF8(filesystem_id); |
[email protected] | b2324b09 | 2012-11-01 10:34:11 | [diff] [blame] | 212 | } |
| 213 | |
| 214 | long long WebKitTestRunner::getCurrentTimeInMillisecond() { |
| 215 | return base::TimeTicks::Now().ToInternalValue() / |
| 216 | base::Time::kMicrosecondsPerMillisecond; |
| 217 | } |
| 218 | |
| 219 | WebString WebKitTestRunner::getAbsoluteWebStringFromUTF8Path( |
| 220 | const std::string& utf8_path) { |
[email protected] | 0d2dfb92d | 2012-11-05 10:26:45 | [diff] [blame] | 221 | #if defined(OS_WIN) |
[email protected] | d30a36f | 2013-02-07 04:16:26 | [diff] [blame] | 222 | base::FilePath path(UTF8ToWide(utf8_path)); |
[email protected] | 0d2dfb92d | 2012-11-05 10:26:45 | [diff] [blame] | 223 | #else |
[email protected] | d30a36f | 2013-02-07 04:16:26 | [diff] [blame] | 224 | base::FilePath path(base::SysWideToNativeMB(base::SysUTF8ToWide(utf8_path))); |
[email protected] | 0d2dfb92d | 2012-11-05 10:26:45 | [diff] [blame] | 225 | #endif |
| 226 | if (!path.IsAbsolute()) { |
| 227 | GURL base_url = |
| 228 | net::FilePathToFileURL(current_working_directory_.Append( |
| 229 | FILE_PATH_LITERAL("foo"))); |
| 230 | net::FileURLToFilePath(base_url.Resolve(utf8_path), &path); |
| 231 | } |
[email protected] | 984a5f7 | 2012-12-13 21:41:50 | [diff] [blame] | 232 | return webkit_base::FilePathToWebString(path); |
[email protected] | b2324b09 | 2012-11-01 10:34:11 | [diff] [blame] | 233 | } |
| 234 | |
[email protected] | 09ec9f9 | 2012-12-17 09:46:36 | [diff] [blame] | 235 | WebURL WebKitTestRunner::localFileToDataURL(const WebURL& file_url) { |
[email protected] | d30a36f | 2013-02-07 04:16:26 | [diff] [blame] | 236 | base::FilePath local_path; |
[email protected] | 09ec9f9 | 2012-12-17 09:46:36 | [diff] [blame] | 237 | if (!net::FileURLToFilePath(file_url, &local_path)) |
| 238 | return WebURL(); |
| 239 | |
| 240 | std::string contents; |
| 241 | Send(new ShellViewHostMsg_ReadFileToString( |
| 242 | routing_id(), local_path, &contents)); |
| 243 | |
| 244 | std::string contents_base64; |
| 245 | if (!base::Base64Encode(contents, &contents_base64)) |
| 246 | return WebURL(); |
| 247 | |
| 248 | const char data_url_prefix[] = "data:text/css:charset=utf-8;base64,"; |
| 249 | return WebURL(GURL(data_url_prefix + contents_base64)); |
| 250 | } |
| 251 | |
| 252 | WebURL WebKitTestRunner::rewriteLayoutTestsURL(const std::string& utf8_url) { |
| 253 | const char kPrefix[] = "file:///tmp/LayoutTests/"; |
| 254 | const int kPrefixLen = arraysize(kPrefix) - 1; |
| 255 | |
| 256 | if (utf8_url.compare(0, kPrefixLen, kPrefix, kPrefixLen)) |
| 257 | return WebURL(GURL(utf8_url)); |
| 258 | |
[email protected] | d30a36f | 2013-02-07 04:16:26 | [diff] [blame] | 259 | base::FilePath replace_path = |
[email protected] | 09ec9f9 | 2012-12-17 09:46:36 | [diff] [blame] | 260 | ShellRenderProcessObserver::GetInstance()->webkit_source_dir().Append( |
| 261 | FILE_PATH_LITERAL("LayoutTests/")); |
| 262 | #if defined(OS_WIN) |
| 263 | std::string utf8_path = WideToUTF8(replace_path.value()); |
| 264 | #else |
| 265 | std::string utf8_path = |
| 266 | WideToUTF8(base::SysNativeMBToWide(replace_path.value())); |
| 267 | #endif |
| 268 | std::string new_url = |
| 269 | std::string("file://") + utf8_path + utf8_url.substr(kPrefixLen); |
| 270 | return WebURL(GURL(new_url)); |
| 271 | } |
| 272 | |
[email protected] | b3dbcb5e | 2012-12-17 00:16:37 | [diff] [blame] | 273 | WebPreferences* WebKitTestRunner::preferences() { |
| 274 | return &prefs_; |
| 275 | } |
| 276 | |
| 277 | void WebKitTestRunner::applyPreferences() { |
| 278 | webkit_glue::WebPreferences prefs = render_view()->GetWebkitPreferences(); |
[email protected] | d48eab08 | 2012-12-19 09:25:47 | [diff] [blame] | 279 | ExportLayoutTestSpecificPreferences(prefs_, &prefs); |
[email protected] | b3dbcb5e | 2012-12-17 00:16:37 | [diff] [blame] | 280 | render_view()->SetWebkitPreferences(prefs); |
[email protected] | 55915a7 | 2012-12-18 11:55:25 | [diff] [blame] | 281 | Send(new ShellViewHostMsg_OverridePreferences(routing_id(), prefs)); |
[email protected] | b3dbcb5e | 2012-12-17 00:16:37 | [diff] [blame] | 282 | } |
| 283 | |
[email protected] | 9d9ec98 | 2013-01-10 18:53:39 | [diff] [blame] | 284 | std::string WebKitTestRunner::makeURLErrorDescription( |
| 285 | const WebURLError& error) { |
| 286 | std::string domain = error.domain.utf8(); |
| 287 | int code = error.reason; |
| 288 | |
| 289 | if (domain == net::kErrorDomain) { |
| 290 | domain = "NSURLErrorDomain"; |
| 291 | switch (error.reason) { |
| 292 | case net::ERR_ABORTED: |
| 293 | code = -999; // NSURLErrorCancelled |
| 294 | break; |
| 295 | case net::ERR_UNSAFE_PORT: |
| 296 | // Our unsafe port checking happens at the network stack level, but we |
| 297 | // make this translation here to match the behavior of stock WebKit. |
| 298 | domain = "WebKitErrorDomain"; |
| 299 | code = 103; |
| 300 | break; |
| 301 | case net::ERR_ADDRESS_INVALID: |
| 302 | case net::ERR_ADDRESS_UNREACHABLE: |
| 303 | case net::ERR_NETWORK_ACCESS_DENIED: |
| 304 | code = -1004; // NSURLErrorCannotConnectToHost |
| 305 | break; |
| 306 | } |
| 307 | } else { |
| 308 | DLOG(WARNING) << "Unknown error domain"; |
| 309 | } |
| 310 | |
| 311 | return base::StringPrintf("<NSError domain %s, code %d, failing URL \"%s\">", |
| 312 | domain.c_str(), code, error.unreachableURL.spec().data()); |
| 313 | } |
| 314 | |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 315 | void WebKitTestRunner::setClientWindowRect(const WebRect& rect) { |
[email protected] | 8be1c58 | 2013-03-06 00:55:03 | [diff] [blame] | 316 | ForceResizeRenderView(render_view(), WebSize(rect.width, rect.height)); |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 317 | } |
| 318 | |
| 319 | void WebKitTestRunner::showDevTools() { |
[email protected] | f85c584 | 2013-02-15 14:15:06 | [diff] [blame] | 320 | Send(new ShellViewHostMsg_ShowDevTools(routing_id())); |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 321 | } |
| 322 | |
| 323 | void WebKitTestRunner::closeDevTools() { |
[email protected] | f85c584 | 2013-02-15 14:15:06 | [diff] [blame] | 324 | Send(new ShellViewHostMsg_CloseDevTools(routing_id())); |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 325 | } |
| 326 | |
| 327 | void WebKitTestRunner::evaluateInWebInspector(long call_id, |
| 328 | const std::string& script) { |
[email protected] | f85c584 | 2013-02-15 14:15:06 | [diff] [blame] | 329 | WebDevToolsAgent* agent = render_view()->GetWebView()->devToolsAgent(); |
| 330 | if (agent) |
| 331 | agent->evaluateInWebInspector(call_id, WebString::fromUTF8(script)); |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 332 | } |
| 333 | |
| 334 | void WebKitTestRunner::clearAllDatabases() { |
[email protected] | 833b700d | 2013-02-18 19:43:00 | [diff] [blame] | 335 | Send(new ShellViewHostMsg_ClearAllDatabases(routing_id())); |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 336 | } |
| 337 | |
| 338 | void WebKitTestRunner::setDatabaseQuota(int quota) { |
[email protected] | 833b700d | 2013-02-18 19:43:00 | [diff] [blame] | 339 | Send(new ShellViewHostMsg_SetDatabaseQuota(routing_id(), quota)); |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 340 | } |
| 341 | |
| 342 | void WebKitTestRunner::setDeviceScaleFactor(float factor) { |
[email protected] | db6769c | 2013-02-24 14:59:14 | [diff] [blame] | 343 | render_view()->GetWebView()->setDeviceScaleFactor(factor); |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 344 | } |
| 345 | |
[email protected] | 83654ec | 2013-03-04 15:58:53 | [diff] [blame] | 346 | void WebKitTestRunner::setFocus(WebTestProxyBase* proxy, bool focus) { |
[email protected] | 95026a0 | 2013-03-05 08:34:30 | [diff] [blame] | 347 | ProxyToRenderViewVisitor visitor(proxy); |
| 348 | RenderView::ForEach(&visitor); |
| 349 | if (!visitor.render_view()) { |
| 350 | NOTREACHED(); |
| 351 | return; |
| 352 | } |
| 353 | |
| 354 | // Check whether the focused view was closed meanwhile. |
| 355 | if (!WebKitTestRunner::Get(focused_view_)) |
| 356 | focused_view_ = NULL; |
| 357 | |
| 358 | if (focus) { |
| 359 | if (focused_view_ != visitor.render_view()) { |
| 360 | if (focused_view_) |
| 361 | SetFocusAndActivate(focused_view_, false); |
| 362 | SetFocusAndActivate(visitor.render_view(), true); |
| 363 | focused_view_ = visitor.render_view(); |
| 364 | } |
| 365 | } else { |
| 366 | if (focused_view_ == visitor.render_view()) { |
| 367 | SetFocusAndActivate(visitor.render_view(), false); |
| 368 | focused_view_ = NULL; |
| 369 | } |
| 370 | } |
[email protected] | 83654ec | 2013-03-04 15:58:53 | [diff] [blame] | 371 | } |
| 372 | |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 373 | void WebKitTestRunner::setFocus(bool focus) { |
[email protected] | 83654ec | 2013-03-04 15:58:53 | [diff] [blame] | 374 | // TODO(jochen): Remove once the new WebKit API is rolled. |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 375 | } |
| 376 | |
| 377 | void WebKitTestRunner::setAcceptAllCookies(bool accept) { |
[email protected] | 833b700d | 2013-02-18 19:43:00 | [diff] [blame] | 378 | Send(new ShellViewHostMsg_AcceptAllCookies(routing_id(), accept)); |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 379 | } |
| 380 | |
| 381 | std::string WebKitTestRunner::pathToLocalResource(const std::string& resource) { |
[email protected] | 0c5f222 | 2013-02-20 11:26:19 | [diff] [blame] | 382 | #if defined(OS_WIN) |
| 383 | if (resource.find("/tmp/") == 0) { |
| 384 | // We want a temp file. |
| 385 | GURL base_url = net::FilePathToFileURL(temp_path_); |
| 386 | return base_url.Resolve(resource.substr(strlen("/tmp/"))).spec(); |
| 387 | } |
| 388 | #endif |
| 389 | |
| 390 | // Some layout tests use file://// which we resolve as a UNC path. Normalize |
| 391 | // them to just file:///. |
| 392 | std::string result = resource; |
| 393 | while (StringToLowerASCII(result).find("file:////") == 0) { |
| 394 | result = result.substr(0, strlen("file:///")) + |
| 395 | result.substr(strlen("file:////")); |
| 396 | } |
| 397 | return rewriteLayoutTestsURL(result).spec(); |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 398 | } |
| 399 | |
| 400 | void WebKitTestRunner::setLocale(const std::string& locale) { |
[email protected] | 833b700d | 2013-02-18 19:43:00 | [diff] [blame] | 401 | setlocale(LC_ALL, locale.c_str()); |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 402 | } |
| 403 | |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 404 | void WebKitTestRunner::testFinished() { |
[email protected] | 0bfe175 | 2013-03-07 08:44:26 | [diff] [blame] | 405 | if (!is_main_window_ || !test_is_running_) |
[email protected] | 5f20df36 | 2013-02-15 19:48:19 | [diff] [blame] | 406 | return; |
| 407 | WebTestInterfaces* interfaces = |
| 408 | ShellRenderProcessObserver::GetInstance()->test_interfaces(); |
| 409 | interfaces->setTestIsRunning(false); |
[email protected] | 0bfe175 | 2013-03-07 08:44:26 | [diff] [blame] | 410 | test_is_running_ = false; |
[email protected] | 8f72269 | 2013-02-23 14:14:06 | [diff] [blame] | 411 | if (interfaces->testRunner()->shouldDumpBackForwardList()) { |
[email protected] | f322356c | 2013-03-01 07:54:02 | [diff] [blame] | 412 | SyncNavigationStateVisitor visitor; |
| 413 | RenderView::ForEach(&visitor); |
[email protected] | 8f72269 | 2013-02-23 14:14:06 | [diff] [blame] | 414 | Send(new ShellViewHostMsg_CaptureSessionHistory(routing_id())); |
| 415 | } else { |
| 416 | CaptureDump(); |
| 417 | } |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 418 | } |
| 419 | |
| 420 | void WebKitTestRunner::testTimedOut() { |
[email protected] | 0bfe175 | 2013-03-07 08:44:26 | [diff] [blame] | 421 | if (!is_main_window_ || !test_is_running_) |
[email protected] | 5f20df36 | 2013-02-15 19:48:19 | [diff] [blame] | 422 | return; |
| 423 | WebTestInterfaces* interfaces = |
| 424 | ShellRenderProcessObserver::GetInstance()->test_interfaces(); |
| 425 | interfaces->setTestIsRunning(false); |
[email protected] | 0bfe175 | 2013-03-07 08:44:26 | [diff] [blame] | 426 | test_is_running_ = false; |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 427 | Send(new ShellViewHostMsg_TestFinished(routing_id(), true)); |
| 428 | } |
| 429 | |
| 430 | bool WebKitTestRunner::isBeingDebugged() { |
| 431 | return base::debug::BeingDebugged(); |
| 432 | } |
| 433 | |
| 434 | int WebKitTestRunner::layoutTestTimeout() { |
[email protected] | 0bfe175 | 2013-03-07 08:44:26 | [diff] [blame] | 435 | return test_config_.layout_test_timeout; |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 436 | } |
| 437 | |
| 438 | void WebKitTestRunner::closeRemainingWindows() { |
[email protected] | b778e18 | 2013-03-04 13:32:16 | [diff] [blame] | 439 | Send(new ShellViewHostMsg_CloseRemainingWindows(routing_id())); |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 440 | } |
| 441 | |
| 442 | int WebKitTestRunner::navigationEntryCount() { |
[email protected] | b283d29 | 2013-02-21 08:40:34 | [diff] [blame] | 443 | return GetLocalSessionHistoryLength(render_view()); |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 444 | } |
| 445 | |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 446 | void WebKitTestRunner::goToOffset(int offset) { |
[email protected] | d2494ff | 2013-02-20 08:22:37 | [diff] [blame] | 447 | Send(new ShellViewHostMsg_GoToOffset(routing_id(), offset)); |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 448 | } |
| 449 | |
| 450 | void WebKitTestRunner::reload() { |
[email protected] | d2494ff | 2013-02-20 08:22:37 | [diff] [blame] | 451 | Send(new ShellViewHostMsg_Reload(routing_id())); |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 452 | } |
| 453 | |
| 454 | void WebKitTestRunner::loadURLForFrame(const WebURL& url, |
| 455 | const std::string& frame_name) { |
[email protected] | d2494ff | 2013-02-20 08:22:37 | [diff] [blame] | 456 | Send(new ShellViewHostMsg_LoadURLForFrame( |
| 457 | routing_id(), url, frame_name)); |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 458 | } |
| 459 | |
| 460 | bool WebKitTestRunner::allowExternalPages() { |
[email protected] | 0bfe175 | 2013-03-07 08:44:26 | [diff] [blame] | 461 | return test_config_.allow_external_pages; |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 462 | } |
| 463 | |
| 464 | void WebKitTestRunner::captureHistoryForWindow( |
[email protected] | 9063bf6 | 2013-02-20 19:42:01 | [diff] [blame] | 465 | WebTestProxyBase* proxy, |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 466 | WebVector<WebKit::WebHistoryItem>* history, |
| 467 | size_t* currentEntryIndex) { |
[email protected] | 8f72269 | 2013-02-23 14:14:06 | [diff] [blame] | 468 | size_t pos = 0; |
| 469 | std::vector<int>::iterator id; |
| 470 | for (id = routing_ids_.begin(); id != routing_ids_.end(); ++id, ++pos) { |
| 471 | RenderView* render_view = RenderView::FromRoutingID(*id); |
| 472 | if (!render_view) { |
| 473 | NOTREACHED(); |
| 474 | continue; |
| 475 | } |
| 476 | if (WebKitTestRunner::Get(render_view)->proxy() == proxy) |
| 477 | break; |
| 478 | } |
| 479 | |
| 480 | if (id == routing_ids_.end()) { |
| 481 | NOTREACHED(); |
| 482 | return; |
| 483 | } |
| 484 | size_t num_entries = session_histories_[pos].size(); |
| 485 | *currentEntryIndex = current_entry_indexes_[pos]; |
| 486 | WebVector<WebHistoryItem> result(num_entries); |
| 487 | for (size_t entry = 0; entry < num_entries; ++entry) { |
| 488 | result[entry] = |
| 489 | webkit_glue::HistoryItemFromString(session_histories_[pos][entry]); |
| 490 | } |
| 491 | history->swap(result); |
[email protected] | 29e8270 | 2013-02-14 12:56:40 | [diff] [blame] | 492 | } |
| 493 | |
[email protected] | b2324b09 | 2012-11-01 10:34:11 | [diff] [blame] | 494 | // RenderViewObserver -------------------------------------------------------- |
| 495 | |
[email protected] | 9b4c6cd | 2012-08-20 10:47:45 | [diff] [blame] | 496 | void WebKitTestRunner::DidClearWindowObject(WebFrame* frame) { |
[email protected] | 0bfe175 | 2013-03-07 08:44:26 | [diff] [blame] | 497 | WebTestingSupport::injectInternalsObject(frame); |
| 498 | ShellRenderProcessObserver::GetInstance()->test_interfaces()->bindTo(frame); |
[email protected] | 96b80b47 | 2012-07-03 19:41:56 | [diff] [blame] | 499 | } |
| 500 | |
[email protected] | 9b4c6cd | 2012-08-20 10:47:45 | [diff] [blame] | 501 | bool WebKitTestRunner::OnMessageReceived(const IPC::Message& message) { |
[email protected] | efb5f57 | 2012-01-29 10:57:33 | [diff] [blame] | 502 | bool handled = true; |
[email protected] | 9b4c6cd | 2012-08-20 10:47:45 | [diff] [blame] | 503 | IPC_BEGIN_MESSAGE_MAP(WebKitTestRunner, message) |
[email protected] | 0ac1a03 | 2013-02-12 12:53:37 | [diff] [blame] | 504 | IPC_MESSAGE_HANDLER(ShellViewMsg_SetTestConfiguration, |
| 505 | OnSetTestConfiguration) |
[email protected] | 8f72269 | 2013-02-23 14:14:06 | [diff] [blame] | 506 | IPC_MESSAGE_HANDLER(ShellViewMsg_SessionHistory, OnSessionHistory) |
[email protected] | efb5f57 | 2012-01-29 10:57:33 | [diff] [blame] | 507 | IPC_MESSAGE_UNHANDLED(handled = false) |
| 508 | IPC_END_MESSAGE_MAP() |
| 509 | |
| 510 | return handled; |
| 511 | } |
| 512 | |
[email protected] | 0bfe175 | 2013-03-07 08:44:26 | [diff] [blame] | 513 | void WebKitTestRunner::Navigate(const GURL& url) { |
| 514 | if (!reset_on_next_navigation_) |
| 515 | return; |
| 516 | |
| 517 | reset_on_next_navigation_ = false; |
| 518 | Reset(); |
| 519 | |
| 520 | WebTestInterfaces* interfaces = |
| 521 | ShellRenderProcessObserver::GetInstance()->test_interfaces(); |
| 522 | interfaces->configureForTestWithURL(test_config_.test_url, |
| 523 | test_config_.enable_pixel_dumping); |
| 524 | interfaces->setTestIsRunning(true); |
| 525 | test_is_running_ = true; |
| 526 | } |
| 527 | |
[email protected] | b9fad24c | 2012-11-15 08:22:10 | [diff] [blame] | 528 | // Public methods - ----------------------------------------------------------- |
| 529 | |
[email protected] | 324825d | 2012-11-30 12:37:15 | [diff] [blame] | 530 | void WebKitTestRunner::Reset() { |
[email protected] | 0bfe175 | 2013-03-07 08:44:26 | [diff] [blame] | 531 | ShellRenderProcessObserver::GetInstance()->test_interfaces()->resetAll(); |
[email protected] | ab683b2 | 2013-03-04 09:10:31 | [diff] [blame] | 532 | // The proxy_ is always non-NULL, it is set right after construction. |
| 533 | proxy_->reset(); |
[email protected] | b3dbcb5e | 2012-12-17 00:16:37 | [diff] [blame] | 534 | prefs_.reset(); |
[email protected] | 8f72269 | 2013-02-23 14:14:06 | [diff] [blame] | 535 | routing_ids_.clear(); |
| 536 | session_histories_.clear(); |
| 537 | current_entry_indexes_.clear(); |
[email protected] | 0bfe175 | 2013-03-07 08:44:26 | [diff] [blame] | 538 | // This overrides the WebPreferences, so we have to reset them again. |
| 539 | WebTestingSupport::resetInternalsObject( |
| 540 | render_view()->GetWebView()->mainFrame()); |
| 541 | render_view()->SetWebkitPreferences(render_view()->GetWebkitPreferences()); |
| 542 | setFocus(proxy_, true); |
[email protected] | 324825d | 2012-11-30 12:37:15 | [diff] [blame] | 543 | } |
| 544 | |
[email protected] | b2324b09 | 2012-11-01 10:34:11 | [diff] [blame] | 545 | // Private methods ----------------------------------------------------------- |
| 546 | |
[email protected] | 0ac1a03 | 2013-02-12 12:53:37 | [diff] [blame] | 547 | void WebKitTestRunner::CaptureDump() { |
[email protected] | 5f20df36 | 2013-02-15 19:48:19 | [diff] [blame] | 548 | WebTestInterfaces* interfaces = |
| 549 | ShellRenderProcessObserver::GetInstance()->test_interfaces(); |
| 550 | |
[email protected] | 893fc636 | 2013-02-18 13:24:05 | [diff] [blame] | 551 | if (interfaces->testRunner()->shouldDumpAsAudio()) { |
| 552 | const WebArrayBufferView* audio_data = |
| 553 | interfaces->testRunner()->audioData(); |
| 554 | std::vector<unsigned char> vector_data( |
| 555 | static_cast<const unsigned char*>(audio_data->baseAddress()), |
| 556 | static_cast<const unsigned char*>(audio_data->baseAddress()) + |
| 557 | audio_data->byteLength()); |
| 558 | Send(new ShellViewHostMsg_AudioDump(routing_id(), vector_data)); |
| 559 | Send(new ShellViewHostMsg_TestFinished(routing_id(), false)); |
| 560 | return; |
| 561 | } |
| 562 | |
[email protected] | 5f20df36 | 2013-02-15 19:48:19 | [diff] [blame] | 563 | Send( |
| 564 | new ShellViewHostMsg_TextDump(routing_id(), proxy()->captureTree(false))); |
| 565 | |
[email protected] | 0bfe175 | 2013-03-07 08:44:26 | [diff] [blame] | 566 | if (test_config_.enable_pixel_dumping && |
[email protected] | 1600076 | 2013-03-04 12:43:38 | [diff] [blame] | 567 | interfaces->testRunner()->shouldGeneratePixelResults()) { |
[email protected] | 5f20df36 | 2013-02-15 19:48:19 | [diff] [blame] | 568 | SkBitmap snapshot; |
| 569 | CopyCanvasToBitmap(proxy()->capturePixels(), &snapshot); |
| 570 | |
| 571 | SkAutoLockPixels snapshot_lock(snapshot); |
| 572 | base::MD5Digest digest; |
| 573 | #if defined(OS_ANDROID) |
| 574 | // On Android, pixel layout is RGBA, however, other Chrome platforms use |
| 575 | // BGRA. |
| 576 | const uint8_t* raw_pixels = |
| 577 | reinterpret_cast<const uint8_t*>(snapshot.getPixels()); |
| 578 | size_t snapshot_size = snapshot.getSize(); |
| 579 | scoped_array<uint8_t> reordered_pixels(new uint8_t[snapshot_size]); |
| 580 | for (size_t i = 0; i < snapshot_size; i += 4) { |
| 581 | reordered_pixels[i] = raw_pixels[i + 2]; |
| 582 | reordered_pixels[i + 1] = raw_pixels[i + 1]; |
| 583 | reordered_pixels[i + 2] = raw_pixels[i]; |
| 584 | reordered_pixels[i + 3] = raw_pixels[i + 3]; |
| 585 | } |
| 586 | base::MD5Sum(reordered_pixels.get(), snapshot_size, &digest); |
| 587 | #else |
| 588 | base::MD5Sum(snapshot.getPixels(), snapshot.getSize(), &digest); |
| 589 | #endif |
| 590 | std::string actual_pixel_hash = base::MD5DigestToBase16(digest); |
| 591 | |
[email protected] | 0bfe175 | 2013-03-07 08:44:26 | [diff] [blame] | 592 | if (actual_pixel_hash == test_config_.expected_pixel_hash) { |
[email protected] | 5f20df36 | 2013-02-15 19:48:19 | [diff] [blame] | 593 | SkBitmap empty_image; |
| 594 | Send(new ShellViewHostMsg_ImageDump( |
| 595 | routing_id(), actual_pixel_hash, empty_image)); |
| 596 | } else { |
| 597 | Send(new ShellViewHostMsg_ImageDump( |
| 598 | routing_id(), actual_pixel_hash, snapshot)); |
| 599 | } |
[email protected] | 0ac1a03 | 2013-02-12 12:53:37 | [diff] [blame] | 600 | } |
[email protected] | 5f20df36 | 2013-02-15 19:48:19 | [diff] [blame] | 601 | |
[email protected] | 0ac1a03 | 2013-02-12 12:53:37 | [diff] [blame] | 602 | Send(new ShellViewHostMsg_TestFinished(routing_id(), false)); |
| 603 | } |
| 604 | |
[email protected] | 0ac1a03 | 2013-02-12 12:53:37 | [diff] [blame] | 605 | void WebKitTestRunner::OnSetTestConfiguration( |
[email protected] | 0bfe175 | 2013-03-07 08:44:26 | [diff] [blame] | 606 | const ShellTestConfiguration& params) { |
| 607 | test_config_ = params; |
| 608 | reset_on_next_navigation_ = true; |
[email protected] | 5f20df36 | 2013-02-15 19:48:19 | [diff] [blame] | 609 | is_main_window_ = true; |
[email protected] | 0d2dfb92d | 2012-11-05 10:26:45 | [diff] [blame] | 610 | } |
| 611 | |
[email protected] | 8f72269 | 2013-02-23 14:14:06 | [diff] [blame] | 612 | void WebKitTestRunner::OnSessionHistory( |
| 613 | const std::vector<int>& routing_ids, |
| 614 | const std::vector<std::vector<std::string> >& session_histories, |
| 615 | const std::vector<unsigned>& current_entry_indexes) { |
| 616 | routing_ids_ = routing_ids; |
| 617 | session_histories_ = session_histories; |
| 618 | current_entry_indexes_ = current_entry_indexes; |
| 619 | CaptureDump(); |
| 620 | } |
| 621 | |
[email protected] | 31d71b0 | 2012-01-26 03:42:31 | [diff] [blame] | 622 | } // namespace content |