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

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

Issue 137023014: Added ScopedNSAutoreleasePool to RenderViewTest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved autorelease pool to RenderViewTest 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"
(...skipping 10 matching lines...) Expand all
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 "v8/include/v8.h" 29 #include "v8/include/v8.h"
30 30
31 #if defined(OS_MACOSX)
32 #include "base/mac/scoped_nsautorelease_pool.h"
33 #endif
34
31 using blink::WebFrame; 35 using blink::WebFrame;
32 using blink::WebInputEvent; 36 using blink::WebInputEvent;
33 using blink::WebMouseEvent; 37 using blink::WebMouseEvent;
34 using blink::WebScriptController; 38 using blink::WebScriptController;
35 using blink::WebScriptSource; 39 using blink::WebScriptSource;
36 using blink::WebString; 40 using blink::WebString;
37 using blink::WebURLRequest; 41 using blink::WebURLRequest;
38 42
39 namespace { 43 namespace {
40 const int32 kOpenerId = -2; 44 const int32 kOpenerId = -2;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 140
137 // Subclasses can set render_thread_ with their own implementation before 141 // Subclasses can set render_thread_ with their own implementation before
138 // calling RenderViewTest::SetUp(). 142 // calling RenderViewTest::SetUp().
139 if (!render_thread_) 143 if (!render_thread_)
140 render_thread_.reset(new MockRenderThread()); 144 render_thread_.reset(new MockRenderThread());
141 render_thread_->set_routing_id(kRouteId); 145 render_thread_->set_routing_id(kRouteId);
142 render_thread_->set_surface_id(kSurfaceId); 146 render_thread_->set_surface_id(kSurfaceId);
143 render_thread_->set_new_window_routing_id(kNewWindowRouteId); 147 render_thread_->set_new_window_routing_id(kNewWindowRouteId);
144 render_thread_->set_new_frame_routing_id(kNewFrameRouteId); 148 render_thread_->set_new_frame_routing_id(kNewFrameRouteId);
145 149
150 #if defined(OS_MACOSX)
151 autorelease_pool_.reset(new base::mac::ScopedNSAutoreleasePool());
152 #endif
146 command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM)); 153 command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM));
147 params_.reset(new MainFunctionParams(*command_line_)); 154 params_.reset(new MainFunctionParams(*command_line_));
148 platform_.reset(new RendererMainPlatformDelegate(*params_)); 155 platform_.reset(new RendererMainPlatformDelegate(*params_));
149 platform_->PlatformInitialize(); 156 platform_->PlatformInitialize();
150 157
151 // Setting flags and really doing anything with WebKit is fairly fragile and 158 // Setting flags and really doing anything with WebKit is fairly fragile and
152 // hacky, but this is the world we live in... 159 // hacky, but this is the world we live in...
153 std::string flags("--expose-gc"); 160 std::string flags("--expose-gc");
154 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size())); 161 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size()));
155 blink::initialize(webkit_platform_support_.Get()); 162 blink::initialize(webkit_platform_support_.Get());
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 210
204 render_thread_->SendCloseMessage(); 211 render_thread_->SendCloseMessage();
205 view_ = NULL; 212 view_ = NULL;
206 mock_process_.reset(); 213 mock_process_.reset();
207 214
208 // After telling the view to close and resetting mock_process_ we may get 215 // After telling the view to close and resetting mock_process_ we may get
209 // some new tasks which need to be processed before shutting down WebKit 216 // some new tasks which need to be processed before shutting down WebKit
210 // (http://crbug.com/21508). 217 // (http://crbug.com/21508).
211 base::RunLoop().RunUntilIdle(); 218 base::RunLoop().RunUntilIdle();
212 219
220 #if defined(OS_MACOSX)
221 autorelease_pool_.reset(NULL);
Nico 2014/02/04 16:12:51 Is this necessary? The destructor will run this au
tasak 2014/02/05 04:23:02 Yes. This should be done before blink::shutdown().
Nico 2014/02/05 04:58:22 Cool. Say "// Needs to run before blink::shutdown(
tasak 2014/02/05 05:16:02 Sure. Done.
222 #endif
223
213 blink::shutdown(); 224 blink::shutdown();
214 225
215 platform_->PlatformUninitialize(); 226 platform_->PlatformUninitialize();
216 platform_.reset(); 227 platform_.reset();
217 params_.reset(); 228 params_.reset();
218 command_line_.reset(); 229 command_line_.reset();
219 } 230 }
220 231
221 void RenderViewTest::SendNativeKeyEvent( 232 void RenderViewTest::SendNativeKeyEvent(
222 const NativeWebKeyboardEvent& key_event) { 233 const NativeWebKeyboardEvent& key_event) {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 391
381 ViewMsg_Navigate navigate_message(impl->GetRoutingID(), navigate_params); 392 ViewMsg_Navigate navigate_message(impl->GetRoutingID(), navigate_params);
382 OnMessageReceived(navigate_message); 393 OnMessageReceived(navigate_message);
383 394
384 // The load actually happens asynchronously, so we pump messages to process 395 // The load actually happens asynchronously, so we pump messages to process
385 // the pending continuation. 396 // the pending continuation.
386 ProcessPendingMessages(); 397 ProcessPendingMessages();
387 } 398 }
388 399
389 } // namespace content 400 } // namespace content
OLDNEW
« content/public/test/render_view_test.h ('K') | « content/public/test/render_view_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698