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

Side by Side Diff: content/shell/shell_content_renderer_client.cc

Issue 12450006: [content shell] use the permission client provided by the TestRunner for layout tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | « no previous file | no next file » | 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/shell_content_renderer_client.h" 5 #include "content/shell/shell_content_renderer_client.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/debugger.h" 9 #include "base/debug/debugger.h"
10 #include "content/public/common/content_constants.h" 10 #include "content/public/common/content_constants.h"
11 #include "content/public/common/content_switches.h" 11 #include "content/public/common/content_switches.h"
12 #include "content/public/renderer/render_view.h" 12 #include "content/public/renderer/render_view.h"
13 #include "content/public/test/layouttest_support.h" 13 #include "content/public/test/layouttest_support.h"
14 #include "content/shell/shell_render_process_observer.h" 14 #include "content/shell/shell_render_process_observer.h"
15 #include "content/shell/shell_switches.h" 15 #include "content/shell/shell_switches.h"
16 #include "content/shell/webkit_test_runner.h" 16 #include "content/shell/webkit_test_runner.h"
17 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamCente r.h" 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamCente r.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h"
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
20 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestInterfaces.h" 20 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestInterfaces.h"
21 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestProxy.h" 21 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestProxy.h"
22 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestRunner.h"
22 #include "v8/include/v8.h" 23 #include "v8/include/v8.h"
23 #include "webkit/mocks/mock_webhyphenator.h" 24 #include "webkit/mocks/mock_webhyphenator.h"
24 #include "webkit/tools/test_shell/mock_webclipboard_impl.h" 25 #include "webkit/tools/test_shell/mock_webclipboard_impl.h"
25 #include "webkit/tools/test_shell/test_shell_webmimeregistry_impl.h" 26 #include "webkit/tools/test_shell/test_shell_webmimeregistry_impl.h"
26 27
27 using WebKit::WebClipboard; 28 using WebKit::WebClipboard;
28 using WebKit::WebFrame; 29 using WebKit::WebFrame;
29 using WebKit::WebHyphenator; 30 using WebKit::WebHyphenator;
30 using WebKit::WebMediaStreamCenter; 31 using WebKit::WebMediaStreamCenter;
31 using WebKit::WebMediaStreamCenterClient; 32 using WebKit::WebMediaStreamCenterClient;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 #endif 69 #endif
69 } 70 }
70 71
71 void ShellContentRendererClient::RenderViewCreated(RenderView* render_view) { 72 void ShellContentRendererClient::RenderViewCreated(RenderView* render_view) {
72 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) 73 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree))
73 return; 74 return;
74 WebKitTestRunner* test_runner = WebKitTestRunner::Get(render_view); 75 WebKitTestRunner* test_runner = WebKitTestRunner::Get(render_view);
75 test_runner->Reset(); 76 test_runner->Reset();
76 render_view->GetWebView()->setSpellCheckClient( 77 render_view->GetWebView()->setSpellCheckClient(
77 test_runner->proxy()->spellCheckClient()); 78 test_runner->proxy()->spellCheckClient());
79 render_view->GetWebView()->setPermissionClient(
80 ShellRenderProcessObserver::GetInstance()->test_interfaces()->testRunner()
81 ->webPermissions());
78 WebTestDelegate* delegate = 82 WebTestDelegate* delegate =
79 ShellRenderProcessObserver::GetInstance()->test_delegate(); 83 ShellRenderProcessObserver::GetInstance()->test_delegate();
80 if (delegate == static_cast<WebTestDelegate*>(test_runner)) 84 if (delegate == static_cast<WebTestDelegate*>(test_runner))
81 ShellRenderProcessObserver::GetInstance()->SetMainWindow(render_view); 85 ShellRenderProcessObserver::GetInstance()->SetMainWindow(render_view);
82 } 86 }
83 87
84 bool ShellContentRendererClient::OverrideCreatePlugin( 88 bool ShellContentRendererClient::OverrideCreatePlugin(
85 RenderView* render_view, 89 RenderView* render_view,
86 WebFrame* frame, 90 WebFrame* frame,
87 const WebPluginParams& params, 91 const WebPluginParams& params,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 if (CommandLine::ForCurrentProcess()->HasSwitch( 170 if (CommandLine::ForCurrentProcess()->HasSwitch(
167 switches::kEnableBrowserPluginForAllViewTypes)) { 171 switches::kEnableBrowserPluginForAllViewTypes)) {
168 // Allow BrowserPlugin if forced by command line flag. This is generally 172 // Allow BrowserPlugin if forced by command line flag. This is generally
169 // true for tests. 173 // true for tests.
170 return true; 174 return true;
171 } 175 }
172 return ContentRendererClient::AllowBrowserPlugin(container); 176 return ContentRendererClient::AllowBrowserPlugin(container);
173 } 177 }
174 178
175 } // namespace content 179 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698