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

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

Issue 2023243002: Remove base::Tuple (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lint fix 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 <utility> 10 #include <utility>
10 11
11 #include "base/command_line.h" 12 #include "base/command_line.h"
12 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
15 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
16 #include "base/test/histogram_tester.h" 17 #include "base/test/histogram_tester.h"
17 #include "base/time/time.h" 18 #include "base/time/time.h"
18 #include "build/build_config.h" 19 #include "build/build_config.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // page focus message with the provided focus and routing ID values. 66 // page focus message with the provided focus and routing ID values.
66 void VerifyPageFocusMessage(MockRenderProcessHost* rph, 67 void VerifyPageFocusMessage(MockRenderProcessHost* rph,
67 bool expected_focus, 68 bool expected_focus,
68 int expected_routing_id) { 69 int expected_routing_id) {
69 const IPC::Message* message = 70 const IPC::Message* message =
70 rph->sink().GetUniqueMessageMatching(InputMsg_SetFocus::ID); 71 rph->sink().GetUniqueMessageMatching(InputMsg_SetFocus::ID);
71 EXPECT_TRUE(message); 72 EXPECT_TRUE(message);
72 EXPECT_EQ(expected_routing_id, message->routing_id()); 73 EXPECT_EQ(expected_routing_id, message->routing_id());
73 InputMsg_SetFocus::Param params; 74 InputMsg_SetFocus::Param params;
74 EXPECT_TRUE(InputMsg_SetFocus::Read(message, &params)); 75 EXPECT_TRUE(InputMsg_SetFocus::Read(message, &params));
75 EXPECT_EQ(expected_focus, base::get<0>(params)); 76 EXPECT_EQ(expected_focus, std::get<0>(params));
76 } 77 }
77 78
78 // Helper function for strict mixed content checking tests. 79 // Helper function for strict mixed content checking tests.
79 void CheckMixedContentIPC(TestRenderFrameHost* rfh, 80 void CheckMixedContentIPC(TestRenderFrameHost* rfh,
80 bool expected_param, 81 bool expected_param,
81 int expected_routing_id) { 82 int expected_routing_id) {
82 const IPC::Message* message = 83 const IPC::Message* message =
83 rfh->GetProcess()->sink().GetUniqueMessageMatching( 84 rfh->GetProcess()->sink().GetUniqueMessageMatching(
84 FrameMsg_EnforceStrictMixedContentChecking::ID); 85 FrameMsg_EnforceStrictMixedContentChecking::ID);
85 ASSERT_TRUE(message); 86 ASSERT_TRUE(message);
86 EXPECT_EQ(expected_routing_id, message->routing_id()); 87 EXPECT_EQ(expected_routing_id, message->routing_id());
87 FrameMsg_EnforceStrictMixedContentChecking::Param params; 88 FrameMsg_EnforceStrictMixedContentChecking::Param params;
88 EXPECT_TRUE( 89 EXPECT_TRUE(
89 FrameMsg_EnforceStrictMixedContentChecking::Read(message, &params)); 90 FrameMsg_EnforceStrictMixedContentChecking::Read(message, &params));
90 EXPECT_EQ(expected_param, base::get<0>(params)); 91 EXPECT_EQ(expected_param, std::get<0>(params));
91 } 92 }
92 93
93 class RenderFrameHostManagerTestWebUIControllerFactory 94 class RenderFrameHostManagerTestWebUIControllerFactory
94 : public WebUIControllerFactory { 95 : public WebUIControllerFactory {
95 public: 96 public:
96 RenderFrameHostManagerTestWebUIControllerFactory() 97 RenderFrameHostManagerTestWebUIControllerFactory()
97 : should_create_webui_(false), type_(1) { 98 : should_create_webui_(false), type_(1) {
98 CHECK_NE(reinterpret_cast<WebUI::TypeID>(type_), WebUI::kNoWebUI); 99 CHECK_NE(reinterpret_cast<WebUI::TypeID>(type_), WebUI::kNoWebUI);
99 } 100 }
100 ~RenderFrameHostManagerTestWebUIControllerFactory() override {} 101 ~RenderFrameHostManagerTestWebUIControllerFactory() override {}
(...skipping 2123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2224 2225
2225 // Setting tab2_proxy's opener required an extra IPC message to be set, since 2226 // Setting tab2_proxy's opener required an extra IPC message to be set, since
2226 // the opener's routing ID wasn't available when tab2_proxy was created. 2227 // the opener's routing ID wasn't available when tab2_proxy was created.
2227 // Verify that this IPC was sent and that it passed correct routing ID. 2228 // Verify that this IPC was sent and that it passed correct routing ID.
2228 const IPC::Message* message = 2229 const IPC::Message* message =
2229 rfh2->GetProcess()->sink().GetUniqueMessageMatching( 2230 rfh2->GetProcess()->sink().GetUniqueMessageMatching(
2230 FrameMsg_UpdateOpener::ID); 2231 FrameMsg_UpdateOpener::ID);
2231 EXPECT_TRUE(message); 2232 EXPECT_TRUE(message);
2232 FrameMsg_UpdateOpener::Param params; 2233 FrameMsg_UpdateOpener::Param params;
2233 EXPECT_TRUE(FrameMsg_UpdateOpener::Read(message, &params)); 2234 EXPECT_TRUE(FrameMsg_UpdateOpener::Read(message, &params));
2234 EXPECT_EQ(tab2_opener_routing_id, base::get<0>(params)); 2235 EXPECT_EQ(tab2_opener_routing_id, std::get<0>(params));
2235 } 2236 }
2236 2237
2237 // Test that opener proxies are created properly when the opener points 2238 // Test that opener proxies are created properly when the opener points
2238 // to itself. 2239 // to itself.
2239 TEST_F(RenderFrameHostManagerTest, CreateOpenerProxiesWhenOpenerPointsToSelf) { 2240 TEST_F(RenderFrameHostManagerTest, CreateOpenerProxiesWhenOpenerPointsToSelf) {
2240 const GURL kUrl1("http://www.google.com/"); 2241 const GURL kUrl1("http://www.google.com/");
2241 const GURL kUrl2("http://www.chromium.org/"); 2242 const GURL kUrl2("http://www.chromium.org/");
2242 2243
2243 // Navigate to an initial URL. 2244 // Navigate to an initial URL.
2244 contents()->NavigateAndCommit(kUrl1); 2245 contents()->NavigateAndCommit(kUrl1);
(...skipping 26 matching lines...) Expand all
2271 2272
2272 // Setting the opener in opener_proxy required an extra IPC message, since 2273 // Setting the opener in opener_proxy required an extra IPC message, since
2273 // the opener's routing ID wasn't available when opener_proxy was created. 2274 // the opener's routing ID wasn't available when opener_proxy was created.
2274 // Verify that this IPC was sent and that it passed correct routing ID. 2275 // Verify that this IPC was sent and that it passed correct routing ID.
2275 const IPC::Message* message = 2276 const IPC::Message* message =
2276 rfh2->GetProcess()->sink().GetUniqueMessageMatching( 2277 rfh2->GetProcess()->sink().GetUniqueMessageMatching(
2277 FrameMsg_UpdateOpener::ID); 2278 FrameMsg_UpdateOpener::ID);
2278 EXPECT_TRUE(message); 2279 EXPECT_TRUE(message);
2279 FrameMsg_UpdateOpener::Param params; 2280 FrameMsg_UpdateOpener::Param params;
2280 EXPECT_TRUE(FrameMsg_UpdateOpener::Read(message, &params)); 2281 EXPECT_TRUE(FrameMsg_UpdateOpener::Read(message, &params));
2281 EXPECT_EQ(opener_routing_id, base::get<0>(params)); 2282 EXPECT_EQ(opener_routing_id, std::get<0>(params));
2282 } 2283 }
2283 2284
2284 // Build the following frame opener graph and see that it can be properly 2285 // Build the following frame opener graph and see that it can be properly
2285 // traversed when creating opener proxies: 2286 // traversed when creating opener proxies:
2286 // 2287 //
2287 // +-> root4 <--+ root3 <---- root2 +--- root1 2288 // +-> root4 <--+ root3 <---- root2 +--- root1
2288 // | / | ^ / \ | / \ . 2289 // | / | ^ / \ | / \ .
2289 // | 42 +-----|------- 22 23 <--+ 12 13 2290 // | 42 +-----|------- 22 23 <--+ 12 13
2290 // | +------------+ | | ^ 2291 // | +------------+ | | ^
2291 // +-------------------------------+ +-+ 2292 // +-------------------------------+ +-+
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
3095 commit_params.should_enforce_strict_mixed_content_checking = false; 3096 commit_params.should_enforce_strict_mixed_content_checking = false;
3096 child_host->SendNavigateWithParams(&commit_params); 3097 child_host->SendNavigateWithParams(&commit_params);
3097 EXPECT_NO_FATAL_FAILURE(CheckMixedContentIPC( 3098 EXPECT_NO_FATAL_FAILURE(CheckMixedContentIPC(
3098 main_test_rfh(), false, proxy_to_parent->GetRoutingID())); 3099 main_test_rfh(), false, proxy_to_parent->GetRoutingID()));
3099 EXPECT_FALSE(root->child_at(0) 3100 EXPECT_FALSE(root->child_at(0)
3100 ->current_replication_state() 3101 ->current_replication_state()
3101 .should_enforce_strict_mixed_content_checking); 3102 .should_enforce_strict_mixed_content_checking);
3102 } 3103 }
3103 3104
3104 } // namespace content 3105 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698