OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "content/browser/frame_host/frame_tree.h" | 10 #include "content/browser/frame_host/frame_tree.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 EXPECT_EQ("A=1; B=2; C=3; D=4", | 99 EXPECT_EQ("A=1; B=2; C=3; D=4", |
100 GetCookieFromJS(web_contents_https->GetMainFrame())); | 100 GetCookieFromJS(web_contents_https->GetMainFrame())); |
101 EXPECT_EQ("B=2; D=4", GetCookieFromJS(web_contents_http->GetMainFrame())); | 101 EXPECT_EQ("B=2; D=4", GetCookieFromJS(web_contents_http->GetMainFrame())); |
102 } | 102 } |
103 | 103 |
104 // The RenderMessageFilter will kill processes when they access the cookies of | 104 // The RenderMessageFilter will kill processes when they access the cookies of |
105 // sites other than the site the process is dedicated to, under site isolation. | 105 // sites other than the site the process is dedicated to, under site isolation. |
106 IN_PROC_BROWSER_TEST_F(RenderMessageFilterBrowserTest, | 106 IN_PROC_BROWSER_TEST_F(RenderMessageFilterBrowserTest, |
107 CrossSiteCookieSecurityEnforcement) { | 107 CrossSiteCookieSecurityEnforcement) { |
108 // The code under test is only active under site isolation. | 108 // The code under test is only active under site isolation. |
109 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 109 if (!AreAllSitesIsolatedForTesting()) { |
110 switches::kSitePerProcess)) { | |
111 return; | 110 return; |
112 } | 111 } |
113 | 112 |
114 host_resolver()->AddRule("*", "127.0.0.1"); | 113 host_resolver()->AddRule("*", "127.0.0.1"); |
115 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 114 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
116 SetupCrossSiteRedirector(embedded_test_server()); | 115 SetupCrossSiteRedirector(embedded_test_server()); |
117 NavigateToURL(shell(), | 116 NavigateToURL(shell(), |
118 embedded_test_server()->GetURL("/frame_with_load_event.html")); | 117 embedded_test_server()->GetURL("/frame_with_load_event.html")); |
119 | 118 |
120 WebContentsImpl* tab = static_cast<WebContentsImpl*>(shell()->web_contents()); | 119 WebContentsImpl* tab = static_cast<WebContentsImpl*>(shell()->web_contents()); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 168 |
170 main_frame_killed.Wait(); | 169 main_frame_killed.Wait(); |
171 | 170 |
172 EXPECT_EQ( | 171 EXPECT_EQ( |
173 " Site A\n" | 172 " Site A\n" |
174 "Where A = http://127.0.0.1/ (no process)", | 173 "Where A = http://127.0.0.1/ (no process)", |
175 v.DepictFrameTree(tab->GetFrameTree()->root())); | 174 v.DepictFrameTree(tab->GetFrameTree()->root())); |
176 } | 175 } |
177 | 176 |
178 } // namespace content | 177 } // namespace content |
OLD | NEW |