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

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

Issue 15993018: Reland: Use a shared thread for media operations (round 3). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix stop race Created 7 years, 6 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/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/history_item_serialization.h" 21 #include "content/public/renderer/history_item_serialization.h"
22 #include "content/public/renderer/render_view.h" 22 #include "content/public/renderer/render_view.h"
23 #include "content/public/renderer/render_view_visitor.h" 23 #include "content/public/renderer/render_view_visitor.h"
24 #include "content/public/test/layouttest_support.h" 24 #include "content/public/test/layouttest_support.h"
25 #include "content/shell/common/shell_messages.h" 25 #include "content/shell/common/shell_messages.h"
26 #include "content/shell/common/webkit_test_helpers.h" 26 #include "content/shell/common/webkit_test_helpers.h"
27 #include "content/shell/renderer/shell_render_process_observer.h" 27 #include "content/shell/renderer/shell_render_process_observer.h"
28 #include "media/base/media_log.h"
28 #include "net/base/net_errors.h" 29 #include "net/base/net_errors.h"
29 #include "net/base/net_util.h" 30 #include "net/base/net_util.h"
30 #include "skia/ext/platform_canvas.h" 31 #include "skia/ext/platform_canvas.h"
31 #include "third_party/WebKit/public/platform/Platform.h" 32 #include "third_party/WebKit/public/platform/Platform.h"
32 #include "third_party/WebKit/public/platform/WebCString.h" 33 #include "third_party/WebKit/public/platform/WebCString.h"
33 #include "third_party/WebKit/public/platform/WebPoint.h" 34 #include "third_party/WebKit/public/platform/WebPoint.h"
34 #include "third_party/WebKit/public/platform/WebRect.h" 35 #include "third_party/WebKit/public/platform/WebRect.h"
35 #include "third_party/WebKit/public/platform/WebSize.h" 36 #include "third_party/WebKit/public/platform/WebSize.h"
36 #include "third_party/WebKit/public/platform/WebString.h" 37 #include "third_party/WebKit/public/platform/WebString.h"
37 #include "third_party/WebKit/public/platform/WebURL.h" 38 #include "third_party/WebKit/public/platform/WebURL.h"
(...skipping 15 matching lines...) Expand all
53 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 54 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
54 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web Task.h" 55 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web Task.h"
55 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestInterfaces.h" 56 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestInterfaces.h"
56 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestProxy.h" 57 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestProxy.h"
57 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestRunner.h" 58 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestRunner.h"
58 #include "ui/gfx/rect.h" 59 #include "ui/gfx/rect.h"
59 #include "webkit/base/file_path_string_conversions.h" 60 #include "webkit/base/file_path_string_conversions.h"
60 #include "webkit/common/webpreferences.h" 61 #include "webkit/common/webpreferences.h"
61 #include "webkit/glue/webkit_glue.h" 62 #include "webkit/glue/webkit_glue.h"
62 #include "webkit/mocks/test_media_stream_client.h" 63 #include "webkit/mocks/test_media_stream_client.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"
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;
72 using WebKit::WebHistoryItem; 76 using WebKit::WebHistoryItem;
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 history->swap(result); 532 history->swap(result);
529 } 533 }
530 534
531 WebMediaPlayer* WebKitTestRunner::createWebMediaPlayer( 535 WebMediaPlayer* WebKitTestRunner::createWebMediaPlayer(
532 WebFrame* frame, const WebURL& url, WebMediaPlayerClient* client) 536 WebFrame* frame, const WebURL& url, WebMediaPlayerClient* client)
533 { 537 {
534 if (!test_media_stream_client_) { 538 if (!test_media_stream_client_) {
535 test_media_stream_client_.reset( 539 test_media_stream_client_.reset(
536 new webkit_glue::TestMediaStreamClient()); 540 new webkit_glue::TestMediaStreamClient());
537 } 541 }
538 return webkit_glue::CreateMediaPlayer( 542
539 frame, url, client, test_media_stream_client_.get()); 543 if (test_media_stream_client_->IsMediaStream(url)) {
544 return new webkit_media::WebMediaPlayerMS(
545 frame,
546 client,
547 base::WeakPtr<webkit_media::WebMediaPlayerDelegate>(),
548 test_media_stream_client_.get(),
549 new media::MediaLog());
550 }
551
552 #if defined(OS_ANDROID)
553 return NULL;
554 #else
555 // TODO(scherkus): Use RenderViewImpl::createMediaPlayer() instead of
556 // duplicating code here, see http://crbug.com/239826
557 webkit_media::WebMediaPlayerParams params(
558 GetMediaThreadMessageLoopProxy(), NULL, NULL, new media::MediaLog());
559 return new webkit_media::WebMediaPlayerImpl(
560 frame,
561 client,
562 base::WeakPtr<webkit_media::WebMediaPlayerDelegate>(),
563 params);
564 #endif
540 } 565 }
541 566
542 // RenderViewObserver -------------------------------------------------------- 567 // RenderViewObserver --------------------------------------------------------
543 568
544 void WebKitTestRunner::DidClearWindowObject(WebFrame* frame) { 569 void WebKitTestRunner::DidClearWindowObject(WebFrame* frame) {
545 WebTestingSupport::injectInternalsObject(frame); 570 WebTestingSupport::injectInternalsObject(frame);
546 ShellRenderProcessObserver::GetInstance()->test_interfaces()->bindTo(frame); 571 ShellRenderProcessObserver::GetInstance()->test_interfaces()->bindTo(frame);
547 } 572 }
548 573
549 bool WebKitTestRunner::OnMessageReceived(const IPC::Message& message) { 574 bool WebKitTestRunner::OnMessageReceived(const IPC::Message& message) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 ->loadRequest(WebURLRequest(GURL("about:blank"))); 735 ->loadRequest(WebURLRequest(GURL("about:blank")));
711 Send(new ShellViewHostMsg_ResetDone(routing_id())); 736 Send(new ShellViewHostMsg_ResetDone(routing_id()));
712 } 737 }
713 738
714 void WebKitTestRunner::OnNotifyDone() { 739 void WebKitTestRunner::OnNotifyDone() {
715 render_view()->GetWebView()->mainFrame()->executeScript( 740 render_view()->GetWebView()->mainFrame()->executeScript(
716 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); 741 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();")));
717 } 742 }
718 743
719 } // namespace content 744 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698