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/webkit_test_runner.h" | 5 #include "content/shell/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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 51 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
52 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
Task.h" | 52 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
Task.h" |
53 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
TestInterfaces.h" | 53 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
TestInterfaces.h" |
54 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
TestProxy.h" | 54 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
TestProxy.h" |
55 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
TestRunner.h" | 55 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
TestRunner.h" |
56 #include "ui/gfx/rect.h" | 56 #include "ui/gfx/rect.h" |
57 #include "webkit/base/file_path_string_conversions.h" | 57 #include "webkit/base/file_path_string_conversions.h" |
58 #include "webkit/glue/glue_serialize.h" | 58 #include "webkit/glue/glue_serialize.h" |
59 #include "webkit/glue/webkit_glue.h" | 59 #include "webkit/glue/webkit_glue.h" |
60 #include "webkit/glue/webpreferences.h" | 60 #include "webkit/glue/webpreferences.h" |
| 61 #include "webkit/mocks/test_media_stream_client.h" |
61 | 62 |
62 using WebKit::Platform; | 63 using WebKit::Platform; |
63 using WebKit::WebArrayBufferView; | 64 using WebKit::WebArrayBufferView; |
64 using WebKit::WebContextMenuData; | 65 using WebKit::WebContextMenuData; |
65 using WebKit::WebDevToolsAgent; | 66 using WebKit::WebDevToolsAgent; |
66 using WebKit::WebDeviceOrientation; | 67 using WebKit::WebDeviceOrientation; |
67 using WebKit::WebElement; | 68 using WebKit::WebElement; |
68 using WebKit::WebFrame; | 69 using WebKit::WebFrame; |
69 using WebKit::WebGamepads; | 70 using WebKit::WebGamepads; |
70 using WebKit::WebHistoryItem; | 71 using WebKit::WebHistoryItem; |
| 72 using WebKit::WebMediaPlayer; |
| 73 using WebKit::WebMediaPlayerClient; |
71 using WebKit::WebPoint; | 74 using WebKit::WebPoint; |
72 using WebKit::WebRect; | 75 using WebKit::WebRect; |
73 using WebKit::WebSize; | 76 using WebKit::WebSize; |
74 using WebKit::WebString; | 77 using WebKit::WebString; |
75 using WebKit::WebURL; | 78 using WebKit::WebURL; |
76 using WebKit::WebURLError; | 79 using WebKit::WebURLError; |
77 using WebKit::WebURLRequest; | 80 using WebKit::WebURLRequest; |
78 using WebKit::WebTestingSupport; | 81 using WebKit::WebTestingSupport; |
79 using WebKit::WebVector; | 82 using WebKit::WebVector; |
80 using WebKit::WebView; | 83 using WebKit::WebView; |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 size_t num_entries = session_histories_[pos].size(); | 485 size_t num_entries = session_histories_[pos].size(); |
483 *currentEntryIndex = current_entry_indexes_[pos]; | 486 *currentEntryIndex = current_entry_indexes_[pos]; |
484 WebVector<WebHistoryItem> result(num_entries); | 487 WebVector<WebHistoryItem> result(num_entries); |
485 for (size_t entry = 0; entry < num_entries; ++entry) { | 488 for (size_t entry = 0; entry < num_entries; ++entry) { |
486 result[entry] = | 489 result[entry] = |
487 webkit_glue::HistoryItemFromString(session_histories_[pos][entry]); | 490 webkit_glue::HistoryItemFromString(session_histories_[pos][entry]); |
488 } | 491 } |
489 history->swap(result); | 492 history->swap(result); |
490 } | 493 } |
491 | 494 |
| 495 WebMediaPlayer* WebKitTestRunner::createWebMediaPlayer( |
| 496 WebFrame* frame, const WebURL& url, WebMediaPlayerClient* client) |
| 497 { |
| 498 if (!test_media_stream_client_.get()) { |
| 499 test_media_stream_client_.reset( |
| 500 new webkit_glue::TestMediaStreamClient()); |
| 501 } |
| 502 return webkit_glue::CreateMediaPlayer( |
| 503 frame, url, client, test_media_stream_client_.get()); |
| 504 } |
| 505 |
492 // RenderViewObserver -------------------------------------------------------- | 506 // RenderViewObserver -------------------------------------------------------- |
493 | 507 |
494 void WebKitTestRunner::DidClearWindowObject(WebFrame* frame) { | 508 void WebKitTestRunner::DidClearWindowObject(WebFrame* frame) { |
495 WebTestingSupport::injectInternalsObject(frame); | 509 WebTestingSupport::injectInternalsObject(frame); |
496 ShellRenderProcessObserver::GetInstance()->test_interfaces()->bindTo(frame); | 510 ShellRenderProcessObserver::GetInstance()->test_interfaces()->bindTo(frame); |
497 } | 511 } |
498 | 512 |
499 bool WebKitTestRunner::OnMessageReceived(const IPC::Message& message) { | 513 bool WebKitTestRunner::OnMessageReceived(const IPC::Message& message) { |
500 bool handled = true; | 514 bool handled = true; |
501 IPC_BEGIN_MESSAGE_MAP(WebKitTestRunner, message) | 515 IPC_BEGIN_MESSAGE_MAP(WebKitTestRunner, message) |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 ShellRenderProcessObserver::GetInstance()->test_interfaces()->resetAll(); | 655 ShellRenderProcessObserver::GetInstance()->test_interfaces()->resetAll(); |
642 Reset(); | 656 Reset(); |
643 // Navigating to about:blank will make sure that no new loads are initiated | 657 // Navigating to about:blank will make sure that no new loads are initiated |
644 // by the renderer. | 658 // by the renderer. |
645 render_view()->GetWebView()->mainFrame() | 659 render_view()->GetWebView()->mainFrame() |
646 ->loadRequest(WebURLRequest(GURL("about:blank"))); | 660 ->loadRequest(WebURLRequest(GURL("about:blank"))); |
647 Send(new ShellViewHostMsg_ResetDone(routing_id())); | 661 Send(new ShellViewHostMsg_ResetDone(routing_id())); |
648 } | 662 } |
649 | 663 |
650 } // namespace content | 664 } // namespace content |
OLD | NEW |