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

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: rebase 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
« 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/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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 history->swap(result); 515 history->swap(result);
512 } 516 }
513 517
514 WebMediaPlayer* WebKitTestRunner::createWebMediaPlayer( 518 WebMediaPlayer* WebKitTestRunner::createWebMediaPlayer(
515 WebFrame* frame, const WebURL& url, WebMediaPlayerClient* client) 519 WebFrame* frame, const WebURL& url, WebMediaPlayerClient* client)
516 { 520 {
517 if (!test_media_stream_client_) { 521 if (!test_media_stream_client_) {
518 test_media_stream_client_.reset( 522 test_media_stream_client_.reset(
519 new webkit_glue::TestMediaStreamClient()); 523 new webkit_glue::TestMediaStreamClient());
520 } 524 }
521 return webkit_glue::CreateMediaPlayer( 525
522 frame, url, client, test_media_stream_client_.get()); 526 if (test_media_stream_client_->IsMediaStream(url)) {
527 return new webkit_media::WebMediaPlayerMS(
528 frame,
529 client,
530 base::WeakPtr<webkit_media::WebMediaPlayerDelegate>(),
531 test_media_stream_client_.get(),
532 new media::MediaLog());
533 }
534
535 #if defined(OS_ANDROID)
536 return NULL;
537 #else
538 // TODO(scherkus): Use RenderViewImpl::createMediaPlayer() instead of
539 // duplicating code here, see http://crbug.com/239826
540 webkit_media::WebMediaPlayerParams params(
541 GetMediaThreadMessageLoopProxy(), NULL, NULL, new media::MediaLog());
542 return new webkit_media::WebMediaPlayerImpl(
543 frame,
544 client,
545 base::WeakPtr<webkit_media::WebMediaPlayerDelegate>(),
546 params);
547 #endif
523 } 548 }
524 549
525 // RenderViewObserver -------------------------------------------------------- 550 // RenderViewObserver --------------------------------------------------------
526 551
527 void WebKitTestRunner::DidClearWindowObject(WebFrame* frame) { 552 void WebKitTestRunner::DidClearWindowObject(WebFrame* frame) {
528 WebTestingSupport::injectInternalsObject(frame); 553 WebTestingSupport::injectInternalsObject(frame);
529 ShellRenderProcessObserver::GetInstance()->test_interfaces()->bindTo(frame); 554 ShellRenderProcessObserver::GetInstance()->test_interfaces()->bindTo(frame);
530 } 555 }
531 556
532 bool WebKitTestRunner::OnMessageReceived(const IPC::Message& message) { 557 bool WebKitTestRunner::OnMessageReceived(const IPC::Message& message) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 ->loadRequest(WebURLRequest(GURL("about:blank"))); 718 ->loadRequest(WebURLRequest(GURL("about:blank")));
694 Send(new ShellViewHostMsg_ResetDone(routing_id())); 719 Send(new ShellViewHostMsg_ResetDone(routing_id()));
695 } 720 }
696 721
697 void WebKitTestRunner::OnNotifyDone() { 722 void WebKitTestRunner::OnNotifyDone() {
698 render_view()->GetWebView()->mainFrame()->executeScript( 723 render_view()->GetWebView()->mainFrame()->executeScript(
699 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); 724 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();")));
700 } 725 }
701 726
702 } // namespace content 727 } // 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