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

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

Issue 147973002: Move SetJavaScriptFlags() from webkit to content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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/public/test/render_view_test.h" 5 #include "content/public/test/render_view_test.h"
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "content/common/dom_storage/dom_storage_types.h" 8 #include "content/common/dom_storage/dom_storage_types.h"
9 #include "content/common/input_messages.h" 9 #include "content/common/input_messages.h"
10 #include "content/common/view_messages.h" 10 #include "content/common/view_messages.h"
11 #include "content/public/browser/native_web_keyboard_event.h" 11 #include "content/public/browser/native_web_keyboard_event.h"
12 #include "content/public/common/renderer_preferences.h" 12 #include "content/public/common/renderer_preferences.h"
13 #include "content/public/renderer/history_item_serialization.h" 13 #include "content/public/renderer/history_item_serialization.h"
14 #include "content/renderer/render_thread_impl.h" 14 #include "content/renderer/render_thread_impl.h"
15 #include "content/renderer/render_view_impl.h" 15 #include "content/renderer/render_view_impl.h"
16 #include "content/renderer/renderer_main_platform_delegate.h" 16 #include "content/renderer/renderer_main_platform_delegate.h"
17 #include "content/renderer/renderer_webkitplatformsupport_impl.h" 17 #include "content/renderer/renderer_webkitplatformsupport_impl.h"
18 #include "content/test/mock_render_process.h" 18 #include "content/test/mock_render_process.h"
19 #include "third_party/WebKit/public/platform/WebScreenInfo.h" 19 #include "third_party/WebKit/public/platform/WebScreenInfo.h"
20 #include "third_party/WebKit/public/platform/WebURLRequest.h" 20 #include "third_party/WebKit/public/platform/WebURLRequest.h"
21 #include "third_party/WebKit/public/web/WebFrame.h" 21 #include "third_party/WebKit/public/web/WebFrame.h"
22 #include "third_party/WebKit/public/web/WebHistoryItem.h" 22 #include "third_party/WebKit/public/web/WebHistoryItem.h"
23 #include "third_party/WebKit/public/web/WebInputEvent.h" 23 #include "third_party/WebKit/public/web/WebInputEvent.h"
24 #include "third_party/WebKit/public/web/WebKit.h" 24 #include "third_party/WebKit/public/web/WebKit.h"
25 #include "third_party/WebKit/public/web/WebScriptController.h" 25 #include "third_party/WebKit/public/web/WebScriptController.h"
26 #include "third_party/WebKit/public/web/WebScriptSource.h" 26 #include "third_party/WebKit/public/web/WebScriptSource.h"
27 #include "third_party/WebKit/public/web/WebView.h" 27 #include "third_party/WebKit/public/web/WebView.h"
28 #include "ui/base/resource/resource_bundle.h" 28 #include "ui/base/resource/resource_bundle.h"
29 #include "webkit/glue/webkit_glue.h" 29 #include "v8/include/v8.h"
30 30
31 using blink::WebFrame; 31 using blink::WebFrame;
32 using blink::WebInputEvent; 32 using blink::WebInputEvent;
33 using blink::WebMouseEvent; 33 using blink::WebMouseEvent;
34 using blink::WebScriptController; 34 using blink::WebScriptController;
35 using blink::WebScriptSource; 35 using blink::WebScriptSource;
36 using blink::WebString; 36 using blink::WebString;
37 using blink::WebURLRequest; 37 using blink::WebURLRequest;
38 38
39 namespace { 39 namespace {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 render_thread_->set_new_window_routing_id(kNewWindowRouteId); 143 render_thread_->set_new_window_routing_id(kNewWindowRouteId);
144 render_thread_->set_new_frame_routing_id(kNewFrameRouteId); 144 render_thread_->set_new_frame_routing_id(kNewFrameRouteId);
145 145
146 command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM)); 146 command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM));
147 params_.reset(new MainFunctionParams(*command_line_)); 147 params_.reset(new MainFunctionParams(*command_line_));
148 platform_.reset(new RendererMainPlatformDelegate(*params_)); 148 platform_.reset(new RendererMainPlatformDelegate(*params_));
149 platform_->PlatformInitialize(); 149 platform_->PlatformInitialize();
150 150
151 // Setting flags and really doing anything with WebKit is fairly fragile and 151 // Setting flags and really doing anything with WebKit is fairly fragile and
152 // hacky, but this is the world we live in... 152 // hacky, but this is the world we live in...
153 webkit_glue::SetJavaScriptFlags(" --expose-gc"); 153 static const char expose_gc_flags[] = "--expose-gc";
jam 2014/01/28 07:01:26 nit: seems this would be clearer with just std::st
tfarina 2014/01/28 12:20:31 Done.
154 v8::V8::SetFlagsFromString(expose_gc_flags, sizeof(expose_gc_flags) - 1);
154 blink::initialize(webkit_platform_support_.Get()); 155 blink::initialize(webkit_platform_support_.Get());
155 156
156 // Ensure that we register any necessary schemes when initializing WebKit, 157 // Ensure that we register any necessary schemes when initializing WebKit,
157 // since we are using a MockRenderThread. 158 // since we are using a MockRenderThread.
158 RenderThreadImpl::RegisterSchemes(); 159 RenderThreadImpl::RegisterSchemes();
159 160
160 // This check is needed because when run under content_browsertests, 161 // This check is needed because when run under content_browsertests,
161 // ResourceBundle isn't initialized (since we have to use a diferent test 162 // ResourceBundle isn't initialized (since we have to use a diferent test
162 // suite implementation than for content_unittests). For browser_tests, this 163 // suite implementation than for content_unittests). For browser_tests, this
163 // is already initialized. 164 // is already initialized.
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 380
380 ViewMsg_Navigate navigate_message(impl->GetRoutingID(), navigate_params); 381 ViewMsg_Navigate navigate_message(impl->GetRoutingID(), navigate_params);
381 OnMessageReceived(navigate_message); 382 OnMessageReceived(navigate_message);
382 383
383 // The load actually happens asynchronously, so we pump messages to process 384 // The load actually happens asynchronously, so we pump messages to process
384 // the pending continuation. 385 // the pending continuation.
385 ProcessPendingMessages(); 386 ProcessPendingMessages();
386 } 387 }
387 388
388 } // namespace content 389 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698