Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(680)

Side by Side Diff: content/shell/renderer/webkit_test_runner.cc

Issue 18123002: Migrate webkit/renderer/media/ to content/renderer/media/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: delegates Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
11 #include "base/base64.h" 11 #include "base/base64.h"
12 #include "base/debug/debugger.h" 12 #include "base/debug/debugger.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/md5.h" 14 #include "base/md5.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/message_loop.h" 16 #include "base/message_loop.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
19 #include "base/strings/sys_string_conversions.h" 19 #include "base/strings/sys_string_conversions.h"
20 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
21 #include "base/time.h" 21 #include "base/time.h"
22 #include "content/public/renderer/history_item_serialization.h" 22 #include "content/public/renderer/history_item_serialization.h"
23 #include "content/public/renderer/render_view.h" 23 #include "content/public/renderer/render_view.h"
24 #include "content/public/renderer/render_view_visitor.h" 24 #include "content/public/renderer/render_view_visitor.h"
25 #include "content/public/test/layouttest_support.h" 25 #include "content/public/test/layouttest_support.h"
26 #include "content/renderer/media/webmediaplayer_impl.h"
27 #include "content/renderer/media/webmediaplayer_ms.h"
28 #include "content/renderer/media/webmediaplayer_params.h"
26 #include "content/shell/common/shell_messages.h" 29 #include "content/shell/common/shell_messages.h"
27 #include "content/shell/common/webkit_test_helpers.h" 30 #include "content/shell/common/webkit_test_helpers.h"
28 #include "content/shell/renderer/shell_media_stream_client.h" 31 #include "content/shell/renderer/shell_media_stream_client.h"
29 #include "content/shell/renderer/shell_render_process_observer.h" 32 #include "content/shell/renderer/shell_render_process_observer.h"
30 #include "media/base/media_log.h" 33 #include "media/base/media_log.h"
31 #include "net/base/net_errors.h" 34 #include "net/base/net_errors.h"
32 #include "net/base/net_util.h" 35 #include "net/base/net_util.h"
33 #include "skia/ext/platform_canvas.h" 36 #include "skia/ext/platform_canvas.h"
34 #include "third_party/WebKit/public/platform/Platform.h" 37 #include "third_party/WebKit/public/platform/Platform.h"
35 #include "third_party/WebKit/public/platform/WebCString.h" 38 #include "third_party/WebKit/public/platform/WebCString.h"
(...skipping 18 matching lines...) Expand all
54 #include "third_party/WebKit/public/web/WebElement.h" 57 #include "third_party/WebKit/public/web/WebElement.h"
55 #include "third_party/WebKit/public/web/WebFrame.h" 58 #include "third_party/WebKit/public/web/WebFrame.h"
56 #include "third_party/WebKit/public/web/WebHistoryItem.h" 59 #include "third_party/WebKit/public/web/WebHistoryItem.h"
57 #include "third_party/WebKit/public/web/WebKit.h" 60 #include "third_party/WebKit/public/web/WebKit.h"
58 #include "third_party/WebKit/public/web/WebScriptSource.h" 61 #include "third_party/WebKit/public/web/WebScriptSource.h"
59 #include "third_party/WebKit/public/web/WebTestingSupport.h" 62 #include "third_party/WebKit/public/web/WebTestingSupport.h"
60 #include "third_party/WebKit/public/web/WebView.h" 63 #include "third_party/WebKit/public/web/WebView.h"
61 #include "ui/gfx/rect.h" 64 #include "ui/gfx/rect.h"
62 #include "webkit/common/webpreferences.h" 65 #include "webkit/common/webpreferences.h"
63 #include "webkit/glue/webkit_glue.h" 66 #include "webkit/glue/webkit_glue.h"
64 #include "webkit/renderer/media/webmediaplayer_impl.h"
65 #include "webkit/renderer/media/webmediaplayer_ms.h"
66 #include "webkit/renderer/media/webmediaplayer_params.h"
67 67
68 using WebKit::Platform; 68 using WebKit::Platform;
69 using WebKit::WebArrayBufferView; 69 using WebKit::WebArrayBufferView;
70 using WebKit::WebContextMenuData; 70 using WebKit::WebContextMenuData;
71 using WebKit::WebDevToolsAgent; 71 using WebKit::WebDevToolsAgent;
72 using WebKit::WebDeviceOrientation; 72 using WebKit::WebDeviceOrientation;
73 using WebKit::WebElement; 73 using WebKit::WebElement;
74 using WebKit::WebFrame; 74 using WebKit::WebFrame;
75 using WebKit::WebGamepads; 75 using WebKit::WebGamepads;
76 using WebKit::WebHistoryItem; 76 using WebKit::WebHistoryItem;
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 size_t num_entries = session_histories_[pos].size(); 507 size_t num_entries = session_histories_[pos].size();
508 *currentEntryIndex = current_entry_indexes_[pos]; 508 *currentEntryIndex = current_entry_indexes_[pos];
509 WebVector<WebHistoryItem> result(num_entries); 509 WebVector<WebHistoryItem> result(num_entries);
510 for (size_t entry = 0; entry < num_entries; ++entry) { 510 for (size_t entry = 0; entry < num_entries; ++entry) {
511 result[entry] = 511 result[entry] =
512 PageStateToHistoryItem(session_histories_[pos][entry]); 512 PageStateToHistoryItem(session_histories_[pos][entry]);
513 } 513 }
514 history->swap(result); 514 history->swap(result);
515 } 515 }
516 516
517 // TODO(scherkus): Remove once https://codereview.chromium.org/18130006
518 // rolls into Chromium.
517 WebMediaPlayer* WebKitTestRunner::createWebMediaPlayer( 519 WebMediaPlayer* WebKitTestRunner::createWebMediaPlayer(
518 WebFrame* frame, const WebURL& url, WebMediaPlayerClient* client) 520 WebFrame* frame,
519 { 521 const WebURL& url,
522 WebMediaPlayerClient* client) {
520 if (!shell_media_stream_client_) { 523 if (!shell_media_stream_client_) {
521 shell_media_stream_client_.reset(new ShellMediaStreamClient()); 524 shell_media_stream_client_.reset(new ShellMediaStreamClient());
522 } 525 }
523 526
524 if (shell_media_stream_client_->IsMediaStream(url)) { 527 if (shell_media_stream_client_->IsMediaStream(url)) {
525 return new webkit_media::WebMediaPlayerMS( 528 return new WebMediaPlayerMS(
526 frame, 529 frame,
527 client, 530 client,
528 base::WeakPtr<webkit_media::WebMediaPlayerDelegate>(), 531 base::WeakPtr<WebMediaPlayerDelegate>(),
529 shell_media_stream_client_.get(), 532 shell_media_stream_client_.get(),
530 new media::MediaLog()); 533 new media::MediaLog());
531 } 534 }
532 535
533 #if defined(OS_ANDROID) 536 #if defined(OS_ANDROID)
534 return NULL; 537 return NULL;
535 #else 538 #else
536 // TODO(scherkus): Use RenderViewImpl::createMediaPlayer() instead of 539 WebMediaPlayerParams params(
537 // duplicating code here, see http://crbug.com/239826 540 GetMediaThreadMessageLoopProxy(), NULL, NULL, NULL,
538 webkit_media::WebMediaPlayerParams params( 541 new media::MediaLog());
539 GetMediaThreadMessageLoopProxy(), NULL, NULL, new media::MediaLog()); 542 return new WebMediaPlayerImpl(
540 return new webkit_media::WebMediaPlayerImpl( 543 frame, client, base::WeakPtr<WebMediaPlayerDelegate>(), params);
541 frame,
542 client,
543 base::WeakPtr<webkit_media::WebMediaPlayerDelegate>(),
544 params);
545 #endif 544 #endif
546 } 545 }
547 546
548 // RenderViewObserver -------------------------------------------------------- 547 // RenderViewObserver --------------------------------------------------------
549 548
550 void WebKitTestRunner::DidClearWindowObject(WebFrame* frame) { 549 void WebKitTestRunner::DidClearWindowObject(WebFrame* frame) {
551 WebTestingSupport::injectInternalsObject(frame); 550 WebTestingSupport::injectInternalsObject(frame);
552 ShellRenderProcessObserver::GetInstance()->test_interfaces()->bindTo(frame); 551 ShellRenderProcessObserver::GetInstance()->test_interfaces()->bindTo(frame);
553 } 552 }
554 553
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 ->loadRequest(WebURLRequest(GURL("about:blank"))); 700 ->loadRequest(WebURLRequest(GURL("about:blank")));
702 Send(new ShellViewHostMsg_ResetDone(routing_id())); 701 Send(new ShellViewHostMsg_ResetDone(routing_id()));
703 } 702 }
704 703
705 void WebKitTestRunner::OnNotifyDone() { 704 void WebKitTestRunner::OnNotifyDone() {
706 render_view()->GetWebView()->mainFrame()->executeScript( 705 render_view()->GetWebView()->mainFrame()->executeScript(
707 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); 706 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();")));
708 } 707 }
709 708
710 } // namespace content 709 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698