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

Side by Side Diff: content/browser/frame_host/render_frame_host_manager_unittest.cc

Issue 2079623002: Create only one ContextFactory in content unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add dcheck Created 4 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/frame_host/render_frame_host_manager.h" 5 #include "content/browser/frame_host/render_frame_host_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <tuple> 9 #include <tuple>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/test/histogram_tester.h" 17 #include "base/test/histogram_tester.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "content/browser/compositor/test/no_transport_image_transport_factory.h "
21 #include "content/browser/frame_host/cross_site_transferring_request.h" 20 #include "content/browser/frame_host/cross_site_transferring_request.h"
22 #include "content/browser/frame_host/navigation_controller_impl.h" 21 #include "content/browser/frame_host/navigation_controller_impl.h"
23 #include "content/browser/frame_host/navigation_entry_impl.h" 22 #include "content/browser/frame_host/navigation_entry_impl.h"
24 #include "content/browser/frame_host/navigation_request.h" 23 #include "content/browser/frame_host/navigation_request.h"
25 #include "content/browser/frame_host/navigator.h" 24 #include "content/browser/frame_host/navigator.h"
26 #include "content/browser/frame_host/render_frame_proxy_host.h" 25 #include "content/browser/frame_host/render_frame_proxy_host.h"
27 #include "content/browser/site_instance_impl.h" 26 #include "content/browser/site_instance_impl.h"
28 #include "content/browser/webui/web_ui_controller_factory_registry.h" 27 #include "content/browser/webui/web_ui_controller_factory_registry.h"
29 #include "content/common/frame_messages.h" 28 #include "content/common/frame_messages.h"
30 #include "content/common/input_messages.h" 29 #include "content/common/input_messages.h"
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 DISALLOW_COPY_AND_ASSIGN(PluginFaviconMessageObserver); 298 DISALLOW_COPY_AND_ASSIGN(PluginFaviconMessageObserver);
300 }; 299 };
301 300
302 } // namespace 301 } // namespace
303 302
304 class RenderFrameHostManagerTest : public RenderViewHostImplTestHarness { 303 class RenderFrameHostManagerTest : public RenderViewHostImplTestHarness {
305 public: 304 public:
306 void SetUp() override { 305 void SetUp() override {
307 RenderViewHostImplTestHarness::SetUp(); 306 RenderViewHostImplTestHarness::SetUp();
308 WebUIControllerFactory::RegisterFactory(&factory_); 307 WebUIControllerFactory::RegisterFactory(&factory_);
309 #if !defined(OS_ANDROID)
310 ImageTransportFactory::InitializeForUnitTests(
311 base::WrapUnique(new NoTransportImageTransportFactory));
312 #endif
313 } 308 }
314 309
315 void TearDown() override { 310 void TearDown() override {
316 RenderViewHostImplTestHarness::TearDown(); 311 RenderViewHostImplTestHarness::TearDown();
317 WebUIControllerFactory::UnregisterFactoryForTesting(&factory_); 312 WebUIControllerFactory::UnregisterFactoryForTesting(&factory_);
318 #if !defined(OS_ANDROID)
319 // RenderWidgetHostView holds on to a reference to SurfaceManager, so it
320 // must be shut down before the ImageTransportFactory.
321 ImageTransportFactory::Terminate();
322 #endif
323 } 313 }
324 314
325 void set_should_create_webui(bool should_create_webui) { 315 void set_should_create_webui(bool should_create_webui) {
326 factory_.set_should_create_webui(should_create_webui); 316 factory_.set_should_create_webui(should_create_webui);
327 } 317 }
328 318
329 void set_webui_type(int type) { factory_.set_webui_type(type); } 319 void set_webui_type(int type) { factory_.set_webui_type(type); }
330 320
331 void NavigateActiveAndCommit(const GURL& url) { 321 void NavigateActiveAndCommit(const GURL& url) {
332 // Note: we navigate the active RenderFrameHost because previous navigations 322 // Note: we navigate the active RenderFrameHost because previous navigations
(...skipping 2768 matching lines...) Expand 10 before | Expand all | Expand 10 after
3101 child_host->SendNavigateWithParams(&commit_params); 3091 child_host->SendNavigateWithParams(&commit_params);
3102 EXPECT_NO_FATAL_FAILURE(CheckInsecureRequestPolicyIPC( 3092 EXPECT_NO_FATAL_FAILURE(CheckInsecureRequestPolicyIPC(
3103 main_test_rfh(), blink::kLeaveInsecureRequestsAlone, 3093 main_test_rfh(), blink::kLeaveInsecureRequestsAlone,
3104 proxy_to_parent->GetRoutingID())); 3094 proxy_to_parent->GetRoutingID()));
3105 EXPECT_EQ( 3095 EXPECT_EQ(
3106 blink::kLeaveInsecureRequestsAlone, 3096 blink::kLeaveInsecureRequestsAlone,
3107 root->child_at(0)->current_replication_state().insecure_request_policy); 3097 root->child_at(0)->current_replication_state().insecure_request_policy);
3108 } 3098 }
3109 3099
3110 } // namespace content 3100 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698