| 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 #include "content/shell/renderer/webkit_test_runner.h" | 5 #include "content/shell/renderer/webkit_test_runner.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <clocale> | 8 #include <clocale> |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #include "third_party/WebKit/public/web/WebFrame.h" | 55 #include "third_party/WebKit/public/web/WebFrame.h" |
| 56 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 56 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
| 57 #include "third_party/WebKit/public/web/WebKit.h" | 57 #include "third_party/WebKit/public/web/WebKit.h" |
| 58 #include "third_party/WebKit/public/web/WebScriptSource.h" | 58 #include "third_party/WebKit/public/web/WebScriptSource.h" |
| 59 #include "third_party/WebKit/public/web/WebTestingSupport.h" | 59 #include "third_party/WebKit/public/web/WebTestingSupport.h" |
| 60 #include "third_party/WebKit/public/web/WebView.h" | 60 #include "third_party/WebKit/public/web/WebView.h" |
| 61 #include "ui/gfx/rect.h" | 61 #include "ui/gfx/rect.h" |
| 62 #include "webkit/common/webpreferences.h" | 62 #include "webkit/common/webpreferences.h" |
| 63 #include "webkit/glue/webkit_glue.h" | 63 #include "webkit/glue/webkit_glue.h" |
| 64 | 64 |
| 65 using WebKit::Platform; | 65 using blink::Platform; |
| 66 using WebKit::WebArrayBufferView; | 66 using blink::WebArrayBufferView; |
| 67 using WebKit::WebContextMenuData; | 67 using blink::WebContextMenuData; |
| 68 using WebKit::WebDevToolsAgent; | 68 using blink::WebDevToolsAgent; |
| 69 using WebKit::WebDeviceMotionData; | 69 using blink::WebDeviceMotionData; |
| 70 using WebKit::WebDeviceOrientationData; | 70 using blink::WebDeviceOrientationData; |
| 71 using WebKit::WebElement; | 71 using blink::WebElement; |
| 72 using WebKit::WebFrame; | 72 using blink::WebFrame; |
| 73 using WebKit::WebGamepads; | 73 using blink::WebGamepads; |
| 74 using WebKit::WebHistoryItem; | 74 using blink::WebHistoryItem; |
| 75 using WebKit::WebPoint; | 75 using blink::WebPoint; |
| 76 using WebKit::WebRect; | 76 using blink::WebRect; |
| 77 using WebKit::WebScriptSource; | 77 using blink::WebScriptSource; |
| 78 using WebKit::WebSize; | 78 using blink::WebSize; |
| 79 using WebKit::WebString; | 79 using blink::WebString; |
| 80 using WebKit::WebURL; | 80 using blink::WebURL; |
| 81 using WebKit::WebURLError; | 81 using blink::WebURLError; |
| 82 using WebKit::WebURLRequest; | 82 using blink::WebURLRequest; |
| 83 using WebKit::WebTestingSupport; | 83 using blink::WebTestingSupport; |
| 84 using WebKit::WebVector; | 84 using blink::WebVector; |
| 85 using WebKit::WebView; | 85 using blink::WebView; |
| 86 using WebTestRunner::WebTask; | 86 using WebTestRunner::WebTask; |
| 87 using WebTestRunner::WebTestInterfaces; | 87 using WebTestRunner::WebTestInterfaces; |
| 88 using WebTestRunner::WebTestProxyBase; | 88 using WebTestRunner::WebTestProxyBase; |
| 89 | 89 |
| 90 namespace content { | 90 namespace content { |
| 91 | 91 |
| 92 namespace { | 92 namespace { |
| 93 | 93 |
| 94 void InvokeTaskHelper(void* context) { | 94 void InvokeTaskHelper(void* context) { |
| 95 WebTask* task = reinterpret_cast<WebTask*>(context); | 95 WebTask* task = reinterpret_cast<WebTask*>(context); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 } | 248 } |
| 249 | 249 |
| 250 void WebKitTestRunner::postDelayedTask(WebTask* task, long long ms) { | 250 void WebKitTestRunner::postDelayedTask(WebTask* task, long long ms) { |
| 251 base::MessageLoop::current()->PostDelayedTask( | 251 base::MessageLoop::current()->PostDelayedTask( |
| 252 FROM_HERE, | 252 FROM_HERE, |
| 253 base::Bind(&WebTask::run, base::Owned(task)), | 253 base::Bind(&WebTask::run, base::Owned(task)), |
| 254 base::TimeDelta::FromMilliseconds(ms)); | 254 base::TimeDelta::FromMilliseconds(ms)); |
| 255 } | 255 } |
| 256 | 256 |
| 257 WebString WebKitTestRunner::registerIsolatedFileSystem( | 257 WebString WebKitTestRunner::registerIsolatedFileSystem( |
| 258 const WebKit::WebVector<WebKit::WebString>& absolute_filenames) { | 258 const blink::WebVector<blink::WebString>& absolute_filenames) { |
| 259 std::vector<base::FilePath> files; | 259 std::vector<base::FilePath> files; |
| 260 for (size_t i = 0; i < absolute_filenames.size(); ++i) | 260 for (size_t i = 0; i < absolute_filenames.size(); ++i) |
| 261 files.push_back(base::FilePath::FromUTF16Unsafe(absolute_filenames[i])); | 261 files.push_back(base::FilePath::FromUTF16Unsafe(absolute_filenames[i])); |
| 262 std::string filesystem_id; | 262 std::string filesystem_id; |
| 263 Send(new ShellViewHostMsg_RegisterIsolatedFileSystem( | 263 Send(new ShellViewHostMsg_RegisterIsolatedFileSystem( |
| 264 routing_id(), files, &filesystem_id)); | 264 routing_id(), files, &filesystem_id)); |
| 265 return WebString::fromUTF8(filesystem_id); | 265 return WebString::fromUTF8(filesystem_id); |
| 266 } | 266 } |
| 267 | 267 |
| 268 long long WebKitTestRunner::getCurrentTimeInMillisecond() { | 268 long long WebKitTestRunner::getCurrentTimeInMillisecond() { |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 Send(new ShellViewHostMsg_LoadURLForFrame( | 507 Send(new ShellViewHostMsg_LoadURLForFrame( |
| 508 routing_id(), url, frame_name)); | 508 routing_id(), url, frame_name)); |
| 509 } | 509 } |
| 510 | 510 |
| 511 bool WebKitTestRunner::allowExternalPages() { | 511 bool WebKitTestRunner::allowExternalPages() { |
| 512 return test_config_.allow_external_pages; | 512 return test_config_.allow_external_pages; |
| 513 } | 513 } |
| 514 | 514 |
| 515 void WebKitTestRunner::captureHistoryForWindow( | 515 void WebKitTestRunner::captureHistoryForWindow( |
| 516 WebTestProxyBase* proxy, | 516 WebTestProxyBase* proxy, |
| 517 WebVector<WebKit::WebHistoryItem>* history, | 517 WebVector<blink::WebHistoryItem>* history, |
| 518 size_t* currentEntryIndex) { | 518 size_t* currentEntryIndex) { |
| 519 size_t pos = 0; | 519 size_t pos = 0; |
| 520 std::vector<int>::iterator id; | 520 std::vector<int>::iterator id; |
| 521 for (id = routing_ids_.begin(); id != routing_ids_.end(); ++id, ++pos) { | 521 for (id = routing_ids_.begin(); id != routing_ids_.end(); ++id, ++pos) { |
| 522 RenderView* render_view = RenderView::FromRoutingID(*id); | 522 RenderView* render_view = RenderView::FromRoutingID(*id); |
| 523 if (!render_view) { | 523 if (!render_view) { |
| 524 NOTREACHED(); | 524 NOTREACHED(); |
| 525 continue; | 525 continue; |
| 526 } | 526 } |
| 527 if (WebKitTestRunner::Get(render_view)->proxy() == proxy) | 527 if (WebKitTestRunner::Get(render_view)->proxy() == proxy) |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 WebURLRequest(GURL(kAboutBlankURL))); | 696 WebURLRequest(GURL(kAboutBlankURL))); |
| 697 Send(new ShellViewHostMsg_ResetDone(routing_id())); | 697 Send(new ShellViewHostMsg_ResetDone(routing_id())); |
| 698 } | 698 } |
| 699 | 699 |
| 700 void WebKitTestRunner::OnNotifyDone() { | 700 void WebKitTestRunner::OnNotifyDone() { |
| 701 render_view()->GetWebView()->mainFrame()->executeScript( | 701 render_view()->GetWebView()->mainFrame()->executeScript( |
| 702 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); | 702 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); |
| 703 } | 703 } |
| 704 | 704 |
| 705 } // namespace content | 705 } // namespace content |
| OLD | NEW |