OLD | NEW |
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/browser/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 3127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3138 | 3138 |
3139 std::string a_origin = embedded_test_server()->GetURL("a.com", "/").spec(); | 3139 std::string a_origin = embedded_test_server()->GetURL("a.com", "/").spec(); |
3140 std::string b_origin = embedded_test_server()->GetURL("b.com", "/").spec(); | 3140 std::string b_origin = embedded_test_server()->GetURL("b.com", "/").spec(); |
3141 std::string c_origin = embedded_test_server()->GetURL("c.com", "/").spec(); | 3141 std::string c_origin = embedded_test_server()->GetURL("c.com", "/").spec(); |
3142 FrameTreeNode* tiptop_child = root->child_at(0); | 3142 FrameTreeNode* tiptop_child = root->child_at(0); |
3143 FrameTreeNode* middle_child = root->child_at(0)->child_at(0); | 3143 FrameTreeNode* middle_child = root->child_at(0)->child_at(0); |
3144 FrameTreeNode* lowest_child = root->child_at(0)->child_at(0)->child_at(0); | 3144 FrameTreeNode* lowest_child = root->child_at(0)->child_at(0)->child_at(0); |
3145 | 3145 |
3146 // Check that b.com frame's location.ancestorOrigins contains the correct | 3146 // Check that b.com frame's location.ancestorOrigins contains the correct |
3147 // origin for the parent. The origin should have been replicated as part of | 3147 // origin for the parent. The origin should have been replicated as part of |
3148 // the ViewMsg_New message that created the parent's RenderFrameProxy in | 3148 // the mojom::Renderer::CreateView message that created the parent's |
3149 // b.com's process. | 3149 // RenderFrameProxy in b.com's process. |
3150 int ancestor_origins_length = 0; | 3150 int ancestor_origins_length = 0; |
3151 EXPECT_TRUE(ExecuteScriptAndExtractInt( | 3151 EXPECT_TRUE(ExecuteScriptAndExtractInt( |
3152 tiptop_child, | 3152 tiptop_child, |
3153 "window.domAutomationController.send(location.ancestorOrigins.length);", | 3153 "window.domAutomationController.send(location.ancestorOrigins.length);", |
3154 &ancestor_origins_length)); | 3154 &ancestor_origins_length)); |
3155 EXPECT_EQ(1, ancestor_origins_length); | 3155 EXPECT_EQ(1, ancestor_origins_length); |
3156 std::string result; | 3156 std::string result; |
3157 EXPECT_TRUE(ExecuteScriptAndExtractString( | 3157 EXPECT_TRUE(ExecuteScriptAndExtractString( |
3158 tiptop_child, | 3158 tiptop_child, |
3159 "window.domAutomationController.send(location.ancestorOrigins[0]);", | 3159 "window.domAutomationController.send(location.ancestorOrigins[0]);", |
3160 &result)); | 3160 &result)); |
3161 EXPECT_EQ(a_origin, result + "/"); | 3161 EXPECT_EQ(a_origin, result + "/"); |
3162 | 3162 |
3163 // Check that c.com frame's location.ancestorOrigins contains the correct | 3163 // Check that c.com frame's location.ancestorOrigins contains the correct |
3164 // origin for its two ancestors. The topmost parent origin should be | 3164 // origin for its two ancestors. The topmost parent origin should be |
3165 // replicated as part of ViewMsg_New, and the middle frame (b.com's) origin | 3165 // replicated as part of mojom::Renderer::CreateView, and the middle frame |
3166 // should be replicated as part of FrameMsg_NewFrameProxy sent for b.com's | 3166 // (b.com's) origin should be replicated as part of FrameMsg_NewFrameProxy |
3167 // frame in c.com's process. | 3167 // sent for b.com's frame in c.com's process. |
3168 EXPECT_TRUE(ExecuteScriptAndExtractInt( | 3168 EXPECT_TRUE(ExecuteScriptAndExtractInt( |
3169 middle_child, | 3169 middle_child, |
3170 "window.domAutomationController.send(location.ancestorOrigins.length);", | 3170 "window.domAutomationController.send(location.ancestorOrigins.length);", |
3171 &ancestor_origins_length)); | 3171 &ancestor_origins_length)); |
3172 EXPECT_EQ(2, ancestor_origins_length); | 3172 EXPECT_EQ(2, ancestor_origins_length); |
3173 EXPECT_TRUE(ExecuteScriptAndExtractString( | 3173 EXPECT_TRUE(ExecuteScriptAndExtractString( |
3174 middle_child, | 3174 middle_child, |
3175 "window.domAutomationController.send(location.ancestorOrigins[0]);", | 3175 "window.domAutomationController.send(location.ancestorOrigins[0]);", |
3176 &result)); | 3176 &result)); |
3177 EXPECT_EQ(b_origin, result + "/"); | 3177 EXPECT_EQ(b_origin, result + "/"); |
(...skipping 5046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8224 " Site A ------------ proxies for B C\n" | 8224 " Site A ------------ proxies for B C\n" |
8225 " +--Site B ------- proxies for A C\n" | 8225 " +--Site B ------- proxies for A C\n" |
8226 " +--Site C -- proxies for A B\n" | 8226 " +--Site C -- proxies for A B\n" |
8227 "Where A = http://a.com/\n" | 8227 "Where A = http://a.com/\n" |
8228 " B = http://b.com/\n" | 8228 " B = http://b.com/\n" |
8229 " C = http://c.com/", | 8229 " C = http://c.com/", |
8230 DepictFrameTree(root)); | 8230 DepictFrameTree(root)); |
8231 } | 8231 } |
8232 | 8232 |
8233 } // namespace content | 8233 } // namespace content |
OLD | NEW |