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

Side by Side Diff: content/test/render_view_test.cc

Issue 8414020: Expose the sandbox related code through the content API. I did a bit of cleanup while I was doing... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/test/render_view_test.h" 5 #include "content/test/render_view_test.h"
6 6
7 #include "content/common/dom_storage_common.h" 7 #include "content/common/dom_storage_common.h"
8 #include "content/common/renderer_preferences.h" 8 #include "content/common/renderer_preferences.h"
9 #include "content/common/view_messages.h" 9 #include "content/common/view_messages.h"
10 #include "content/public/browser/native_web_keyboard_event.h" 10 #include "content/public/browser/native_web_keyboard_event.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // RenderViewTest::SetUp(). 89 // RenderViewTest::SetUp().
90 if (!GetContentClient()->renderer()) 90 if (!GetContentClient()->renderer())
91 GetContentClient()->set_renderer(&mock_content_renderer_client_); 91 GetContentClient()->set_renderer(&mock_content_renderer_client_);
92 92
93 // Subclasses can set render_thread_ with their own implementation before 93 // Subclasses can set render_thread_ with their own implementation before
94 // calling RenderViewTest::SetUp(). 94 // calling RenderViewTest::SetUp().
95 if (!render_thread_.get()) 95 if (!render_thread_.get())
96 render_thread_.reset(new MockRenderThread()); 96 render_thread_.reset(new MockRenderThread());
97 render_thread_->set_routing_id(kRouteId); 97 render_thread_->set_routing_id(kRouteId);
98 98
99 sandbox_init_wrapper_.reset(new SandboxInitWrapper());
100 command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM)); 99 command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM));
101 params_.reset(new MainFunctionParams(*command_line_, *sandbox_init_wrapper_, 100 params_.reset(new MainFunctionParams(*command_line_));
102 NULL));
103 platform_.reset(new RendererMainPlatformDelegate(*params_)); 101 platform_.reset(new RendererMainPlatformDelegate(*params_));
104 platform_->PlatformInitialize(); 102 platform_->PlatformInitialize();
105 103
106 // Setting flags and really doing anything with WebKit is fairly fragile and 104 // Setting flags and really doing anything with WebKit is fairly fragile and
107 // hacky, but this is the world we live in... 105 // hacky, but this is the world we live in...
108 webkit_glue::SetJavaScriptFlags(" --expose-gc"); 106 webkit_glue::SetJavaScriptFlags(" --expose-gc");
109 WebKit::initialize(&webkit_platform_support_); 107 WebKit::initialize(&webkit_platform_support_);
110 108
111 mock_process_.reset(new MockRenderProcess); 109 mock_process_.reset(new MockRenderProcess);
112 110
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 msg_loop_.RunAllPending(); 145 msg_loop_.RunAllPending();
148 146
149 WebKit::shutdown(); 147 WebKit::shutdown();
150 148
151 mock_keyboard_.reset(); 149 mock_keyboard_.reset();
152 150
153 platform_->PlatformUninitialize(); 151 platform_->PlatformUninitialize();
154 platform_.reset(); 152 platform_.reset();
155 params_.reset(); 153 params_.reset();
156 command_line_.reset(); 154 command_line_.reset();
157 sandbox_init_wrapper_.reset();
158 } 155 }
159 156
160 int RenderViewTest::SendKeyEvent(MockKeyboard::Layout layout, 157 int RenderViewTest::SendKeyEvent(MockKeyboard::Layout layout,
161 int key_code, 158 int key_code,
162 MockKeyboard::Modifiers modifiers, 159 MockKeyboard::Modifiers modifiers,
163 std::wstring* output) { 160 std::wstring* output) {
164 #if defined(OS_WIN) 161 #if defined(OS_WIN)
165 // Retrieve the Unicode character for the given tuple (keyboard-layout, 162 // Retrieve the Unicode character for the given tuple (keyboard-layout,
166 // key-code, and modifiers). 163 // key-code, and modifiers).
167 // Exit when a keyboard-layout driver cannot assign a Unicode character to 164 // Exit when a keyboard-layout driver cannot assign a Unicode character to
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 336 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
340 impl->set_send_content_state_immediately(true); 337 impl->set_send_content_state_immediately(true);
341 } 338 }
342 339
343 WebKit::WebWidget* RenderViewTest::GetWebWidget() { 340 WebKit::WebWidget* RenderViewTest::GetWebWidget() {
344 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 341 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
345 return impl->webwidget(); 342 return impl->webwidget();
346 } 343 }
347 344
348 } // namespace content 345 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698