| 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 "base/stringprintf.h" | 5 #include "base/stringprintf.h" |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "chrome/browser/automation/automation_util.h" | 7 #include "chrome/browser/automation/automation_util.h" |
| 8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
| 9 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 // Tests that subresource and media requests use the app's cookie store. | 321 // Tests that subresource and media requests use the app's cookie store. |
| 322 // See http://crbug.com/141172. | 322 // See http://crbug.com/141172. |
| 323 IN_PROC_BROWSER_TEST_F(IsolatedAppTest, MAYBE_SubresourceCookieIsolation) { | 323 IN_PROC_BROWSER_TEST_F(IsolatedAppTest, MAYBE_SubresourceCookieIsolation) { |
| 324 host_resolver()->AddRule("*", "127.0.0.1"); | 324 host_resolver()->AddRule("*", "127.0.0.1"); |
| 325 ASSERT_TRUE(test_server()->Start()); | 325 ASSERT_TRUE(test_server()->Start()); |
| 326 | 326 |
| 327 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app1"))); | 327 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app1"))); |
| 328 | 328 |
| 329 // The app under test acts on URLs whose host is "localhost", | 329 // The app under test acts on URLs whose host is "localhost", |
| 330 // so the URLs we navigate to must have host "localhost". | 330 // so the URLs we navigate to must have host "localhost". |
| 331 GURL root_url = test_server()->GetURL(""); | 331 GURL root_url = test_server()->GetURL(std::string()); |
| 332 GURL base_url = test_server()->GetURL("files/extensions/isolated_apps/"); | 332 GURL base_url = test_server()->GetURL("files/extensions/isolated_apps/"); |
| 333 GURL::Replacements replace_host; | 333 GURL::Replacements replace_host; |
| 334 std::string host_str("localhost"); // Must stay in scope with replace_host. | 334 std::string host_str("localhost"); // Must stay in scope with replace_host. |
| 335 replace_host.SetHostStr(host_str); | 335 replace_host.SetHostStr(host_str); |
| 336 root_url = root_url.ReplaceComponents(replace_host); | 336 root_url = root_url.ReplaceComponents(replace_host); |
| 337 base_url = base_url.ReplaceComponents(replace_host); | 337 base_url = base_url.ReplaceComponents(replace_host); |
| 338 | 338 |
| 339 // First set cookies inside and outside the app. | 339 // First set cookies inside and outside the app. |
| 340 ui_test_utils::NavigateToURLWithDisposition( | 340 ui_test_utils::NavigateToURLWithDisposition( |
| 341 browser(), root_url.Resolve("set-cookie?nonApp=1"), | 341 browser(), root_url.Resolve("set-cookie?nonApp=1"), |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 EXPECT_EQ("ss_app2", result); | 508 EXPECT_EQ("ss_app2", result); |
| 509 | 509 |
| 510 ui_test_utils::NavigateToURLWithDisposition( | 510 ui_test_utils::NavigateToURLWithDisposition( |
| 511 browser(), base_url.Resolve("non_app/main.html"), | 511 browser(), base_url.Resolve("non_app/main.html"), |
| 512 CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 512 CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 513 ASSERT_TRUE(ExecuteScriptAndExtractString( | 513 ASSERT_TRUE(ExecuteScriptAndExtractString( |
| 514 browser()->tab_strip_model()->GetWebContentsAt(0), | 514 browser()->tab_strip_model()->GetWebContentsAt(0), |
| 515 kRetrieveSessionStorage.c_str(), &result)); | 515 kRetrieveSessionStorage.c_str(), &result)); |
| 516 EXPECT_EQ("ss_normal", result); | 516 EXPECT_EQ("ss_normal", result); |
| 517 } | 517 } |
| OLD | NEW |