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

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: 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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 WebMediaPlayer* WebKitTestRunner::createWebMediaPlayer( 517 WebMediaPlayer* WebKitTestRunner::createWebMediaPlayer(
518 WebFrame* frame, const WebURL& url, WebMediaPlayerClient* client) 518 WebFrame* frame,
519 { 519 const WebURL& url,
520 WebMediaPlayerClient* client) {
520 if (!shell_media_stream_client_) { 521 if (!shell_media_stream_client_) {
521 shell_media_stream_client_.reset(new ShellMediaStreamClient()); 522 shell_media_stream_client_.reset(new ShellMediaStreamClient());
522 } 523 }
523 524
524 if (shell_media_stream_client_->IsMediaStream(url)) { 525 if (shell_media_stream_client_->IsMediaStream(url)) {
525 return new webkit_media::WebMediaPlayerMS( 526 return new WebMediaPlayerMS(
526 frame, 527 frame,
527 client, 528 client,
528 base::WeakPtr<webkit_media::WebMediaPlayerDelegate>(), 529 base::WeakPtr<WebMediaPlayerDelegate>(),
529 shell_media_stream_client_.get(), 530 shell_media_stream_client_.get(),
530 new media::MediaLog()); 531 new media::MediaLog());
531 } 532 }
532 533
533 #if defined(OS_ANDROID) 534 #if defined(OS_ANDROID)
534 return NULL; 535 return NULL;
535 #else 536 #else
536 // TODO(scherkus): Use RenderViewImpl::createMediaPlayer() instead of 537 // TODO(scherkus): Use RenderViewImpl::createMediaPlayer() instead of
537 // duplicating code here, see http://crbug.com/239826 538 // duplicating code here, see http://crbug.com/239826
538 webkit_media::WebMediaPlayerParams params( 539 WebMediaPlayerParams params(
539 GetMediaThreadMessageLoopProxy(), NULL, NULL, new media::MediaLog()); 540 GetMediaThreadMessageLoopProxy(), NULL, NULL, new media::MediaLog());
540 return new webkit_media::WebMediaPlayerImpl( 541 return new WebMediaPlayerImpl(
541 frame, 542 frame, client, base::WeakPtr<WebMediaPlayerDelegate>(), params);
542 client,
543 base::WeakPtr<webkit_media::WebMediaPlayerDelegate>(),
544 params);
545 #endif 543 #endif
546 } 544 }
547 545
548 // RenderViewObserver -------------------------------------------------------- 546 // RenderViewObserver --------------------------------------------------------
549 547
550 void WebKitTestRunner::DidClearWindowObject(WebFrame* frame) { 548 void WebKitTestRunner::DidClearWindowObject(WebFrame* frame) {
551 WebTestingSupport::injectInternalsObject(frame); 549 WebTestingSupport::injectInternalsObject(frame);
552 ShellRenderProcessObserver::GetInstance()->test_interfaces()->bindTo(frame); 550 ShellRenderProcessObserver::GetInstance()->test_interfaces()->bindTo(frame);
553 } 551 }
554 552
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 ->loadRequest(WebURLRequest(GURL("about:blank"))); 699 ->loadRequest(WebURLRequest(GURL("about:blank")));
702 Send(new ShellViewHostMsg_ResetDone(routing_id())); 700 Send(new ShellViewHostMsg_ResetDone(routing_id()));
703 } 701 }
704 702
705 void WebKitTestRunner::OnNotifyDone() { 703 void WebKitTestRunner::OnNotifyDone() {
706 render_view()->GetWebView()->mainFrame()->executeScript( 704 render_view()->GetWebView()->mainFrame()->executeScript(
707 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); 705 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();")));
708 } 706 }
709 707
710 } // namespace content 708 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698