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

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

Issue 15005005: Use a shared thread for media operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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
« no previous file with comments | « content/shell/renderer/DEPS ('k') | content/test/layouttest_support.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/md5.h" 13 #include "base/md5.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/message_loop.h" 15 #include "base/message_loop.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "base/stringprintf.h" 17 #include "base/stringprintf.h"
18 #include "base/strings/sys_string_conversions.h" 18 #include "base/strings/sys_string_conversions.h"
19 #include "base/time.h" 19 #include "base/time.h"
20 #include "base/utf_string_conversions.h" 20 #include "base/utf_string_conversions.h"
21 #include "content/public/renderer/render_view.h" 21 #include "content/public/renderer/render_view.h"
22 #include "content/public/renderer/render_view_visitor.h" 22 #include "content/public/renderer/render_view_visitor.h"
23 #include "content/public/test/layouttest_support.h" 23 #include "content/public/test/layouttest_support.h"
24 #include "content/shell/common/shell_messages.h" 24 #include "content/shell/common/shell_messages.h"
25 #include "content/shell/common/webkit_test_helpers.h" 25 #include "content/shell/common/webkit_test_helpers.h"
26 #include "content/shell/renderer/shell_render_process_observer.h" 26 #include "content/shell/renderer/shell_render_process_observer.h"
27 #include "media/base/media_log.h"
27 #include "net/base/net_errors.h" 28 #include "net/base/net_errors.h"
28 #include "net/base/net_util.h" 29 #include "net/base/net_util.h"
29 #include "skia/ext/platform_canvas.h" 30 #include "skia/ext/platform_canvas.h"
30 #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h" 31 #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h"
31 #include "third_party/WebKit/Source/Platform/chromium/public/WebCString.h" 32 #include "third_party/WebKit/Source/Platform/chromium/public/WebCString.h"
32 #include "third_party/WebKit/Source/Platform/chromium/public/WebPoint.h" 33 #include "third_party/WebKit/Source/Platform/chromium/public/WebPoint.h"
33 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" 34 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h"
34 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" 35 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
35 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" 36 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h"
36 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" 37 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h"
(...skipping 15 matching lines...) Expand all
52 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 53 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
53 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web Task.h" 54 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web Task.h"
54 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestInterfaces.h" 55 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestInterfaces.h"
55 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestProxy.h" 56 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestProxy.h"
56 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestRunner.h" 57 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestRunner.h"
57 #include "ui/gfx/rect.h" 58 #include "ui/gfx/rect.h"
58 #include "webkit/base/file_path_string_conversions.h" 59 #include "webkit/base/file_path_string_conversions.h"
59 #include "webkit/glue/glue_serialize.h" 60 #include "webkit/glue/glue_serialize.h"
60 #include "webkit/glue/webkit_glue.h" 61 #include "webkit/glue/webkit_glue.h"
61 #include "webkit/glue/webpreferences.h" 62 #include "webkit/glue/webpreferences.h"
63 #include "webkit/media/webmediaplayer_impl.h"
64 #include "webkit/media/webmediaplayer_ms.h"
65 #include "webkit/media/webmediaplayer_params.h"
62 #include "webkit/mocks/test_media_stream_client.h" 66 #include "webkit/mocks/test_media_stream_client.h"
63 67
64 using WebKit::Platform; 68 using WebKit::Platform;
65 using WebKit::WebArrayBufferView; 69 using WebKit::WebArrayBufferView;
66 using WebKit::WebContextMenuData; 70 using WebKit::WebContextMenuData;
67 using WebKit::WebDevToolsAgent; 71 using WebKit::WebDevToolsAgent;
68 using WebKit::WebDeviceOrientation; 72 using WebKit::WebDeviceOrientation;
69 using WebKit::WebElement; 73 using WebKit::WebElement;
70 using WebKit::WebFrame; 74 using WebKit::WebFrame;
71 using WebKit::WebGamepads; 75 using WebKit::WebGamepads;
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 history->swap(result); 521 history->swap(result);
518 } 522 }
519 523
520 WebMediaPlayer* WebKitTestRunner::createWebMediaPlayer( 524 WebMediaPlayer* WebKitTestRunner::createWebMediaPlayer(
521 WebFrame* frame, const WebURL& url, WebMediaPlayerClient* client) 525 WebFrame* frame, const WebURL& url, WebMediaPlayerClient* client)
522 { 526 {
523 if (!test_media_stream_client_) { 527 if (!test_media_stream_client_) {
524 test_media_stream_client_.reset( 528 test_media_stream_client_.reset(
525 new webkit_glue::TestMediaStreamClient()); 529 new webkit_glue::TestMediaStreamClient());
526 } 530 }
527 return webkit_glue::CreateMediaPlayer( 531
528 frame, url, client, test_media_stream_client_.get()); 532 if (test_media_stream_client_->IsMediaStream(url)) {
533 return new webkit_media::WebMediaPlayerMS(
534 frame,
535 client,
536 base::WeakPtr<webkit_media::WebMediaPlayerDelegate>(),
537 test_media_stream_client_.get(),
538 new media::MediaLog());
539 }
540
541 #if defined(OS_ANDROID)
542 return NULL;
543 #else
544 // TODO(scherkus): Use RenderViewImpl::createMediaPlayer() instead of
545 // duplicating code here, see http://crbug.com/239826
546 webkit_media::WebMediaPlayerParams params(
547 GetMediaThreadMessageLoopProxy(), NULL, NULL, new media::MediaLog());
548 return new webkit_media::WebMediaPlayerImpl(
549 frame,
550 client,
551 base::WeakPtr<webkit_media::WebMediaPlayerDelegate>(),
552 params);
553 #endif
529 } 554 }
530 555
531 // RenderViewObserver -------------------------------------------------------- 556 // RenderViewObserver --------------------------------------------------------
532 557
533 void WebKitTestRunner::DidClearWindowObject(WebFrame* frame) { 558 void WebKitTestRunner::DidClearWindowObject(WebFrame* frame) {
534 WebTestingSupport::injectInternalsObject(frame); 559 WebTestingSupport::injectInternalsObject(frame);
535 ShellRenderProcessObserver::GetInstance()->test_interfaces()->bindTo(frame); 560 ShellRenderProcessObserver::GetInstance()->test_interfaces()->bindTo(frame);
536 } 561 }
537 562
538 bool WebKitTestRunner::OnMessageReceived(const IPC::Message& message) { 563 bool WebKitTestRunner::OnMessageReceived(const IPC::Message& message) {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 ->loadRequest(WebURLRequest(GURL("about:blank"))); 721 ->loadRequest(WebURLRequest(GURL("about:blank")));
697 Send(new ShellViewHostMsg_ResetDone(routing_id())); 722 Send(new ShellViewHostMsg_ResetDone(routing_id()));
698 } 723 }
699 724
700 void WebKitTestRunner::OnNotifyDone() { 725 void WebKitTestRunner::OnNotifyDone() {
701 render_view()->GetWebView()->mainFrame()->executeScript( 726 render_view()->GetWebView()->mainFrame()->executeScript(
702 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); 727 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();")));
703 } 728 }
704 729
705 } // namespace content 730 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/DEPS ('k') | content/test/layouttest_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698