OLD | NEW |
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 "base/path_service.h" | 5 #include "base/path_service.h" |
6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/apps/app_browsertest_util.h" | 8 #include "chrome/browser/apps/app_browsertest_util.h" |
9 #include "chrome/browser/chrome_content_browser_client.h" | 9 #include "chrome/browser/chrome_content_browser_client.h" |
10 #include "chrome/browser/prerender/prerender_link_manager.h" | 10 #include "chrome/browser/prerender/prerender_link_manager.h" |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 void NavigateAndOpenAppForIsolation( | 348 void NavigateAndOpenAppForIsolation( |
349 GURL navigate_to_url, | 349 GURL navigate_to_url, |
350 content::WebContents** default_tag_contents1, | 350 content::WebContents** default_tag_contents1, |
351 content::WebContents** default_tag_contents2, | 351 content::WebContents** default_tag_contents2, |
352 content::WebContents** named_partition_contents1, | 352 content::WebContents** named_partition_contents1, |
353 content::WebContents** named_partition_contents2, | 353 content::WebContents** named_partition_contents2, |
354 content::WebContents** persistent_partition_contents1, | 354 content::WebContents** persistent_partition_contents1, |
355 content::WebContents** persistent_partition_contents2, | 355 content::WebContents** persistent_partition_contents2, |
356 content::WebContents** persistent_partition_contents3) { | 356 content::WebContents** persistent_partition_contents3) { |
357 GURL::Replacements replace_host; | 357 GURL::Replacements replace_host; |
358 std::string host_str("localhost"); // Must stay in scope with replace_host. | 358 replace_host.SetHostStr("localhost"); |
359 replace_host.SetHostStr(host_str); | |
360 | 359 |
361 navigate_to_url = navigate_to_url.ReplaceComponents(replace_host); | 360 navigate_to_url = navigate_to_url.ReplaceComponents(replace_host); |
362 | 361 |
363 GURL tag_url1 = embedded_test_server()->GetURL( | 362 GURL tag_url1 = embedded_test_server()->GetURL( |
364 "/extensions/platform_apps/web_view/isolation/cookie.html"); | 363 "/extensions/platform_apps/web_view/isolation/cookie.html"); |
365 tag_url1 = tag_url1.ReplaceComponents(replace_host); | 364 tag_url1 = tag_url1.ReplaceComponents(replace_host); |
366 GURL tag_url2 = embedded_test_server()->GetURL( | 365 GURL tag_url2 = embedded_test_server()->GetURL( |
367 "/extensions/platform_apps/web_view/isolation/cookie2.html"); | 366 "/extensions/platform_apps/web_view/isolation/cookie2.html"); |
368 tag_url2 = tag_url2.ReplaceComponents(replace_host); | 367 tag_url2 = tag_url2.ReplaceComponents(replace_host); |
369 GURL tag_url3 = embedded_test_server()->GetURL( | 368 GURL tag_url3 = embedded_test_server()->GetURL( |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 base::StringPrintf("runTest('%s')", test_name.c_str()))) { | 616 base::StringPrintf("runTest('%s')", test_name.c_str()))) { |
618 LOG(ERROR) << "UNABLE TO START TEST."; | 617 LOG(ERROR) << "UNABLE TO START TEST."; |
619 return; | 618 return; |
620 } | 619 } |
621 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); | 620 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); |
622 } | 621 } |
623 | 622 |
624 content::WebContents* LoadGuest(const std::string& guest_path, | 623 content::WebContents* LoadGuest(const std::string& guest_path, |
625 const std::string& app_path) { | 624 const std::string& app_path) { |
626 GURL::Replacements replace_host; | 625 GURL::Replacements replace_host; |
627 std::string host_str("localhost"); // Must stay in scope with replace_host. | 626 replace_host.SetHostStr("localhost"); |
628 replace_host.SetHostStr(host_str); | |
629 | 627 |
630 GURL guest_url = embedded_test_server()->GetURL(guest_path); | 628 GURL guest_url = embedded_test_server()->GetURL(guest_path); |
631 guest_url = guest_url.ReplaceComponents(replace_host); | 629 guest_url = guest_url.ReplaceComponents(replace_host); |
632 | 630 |
633 ui_test_utils::UrlLoadObserver guest_observer( | 631 ui_test_utils::UrlLoadObserver guest_observer( |
634 guest_url, content::NotificationService::AllSources()); | 632 guest_url, content::NotificationService::AllSources()); |
635 | 633 |
636 LoadAndLaunchPlatformApp(app_path.c_str(), "guest-loaded"); | 634 LoadAndLaunchPlatformApp(app_path.c_str(), "guest-loaded"); |
637 | 635 |
638 guest_observer.Wait(); | 636 guest_observer.Wait(); |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestRemoveWebviewOnExit) { | 1196 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestRemoveWebviewOnExit) { |
1199 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. | 1197 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. |
1200 | 1198 |
1201 // Launch the app and wait until it's ready to load a test. | 1199 // Launch the app and wait until it's ready to load a test. |
1202 LoadAndLaunchPlatformApp("web_view/shim", "Launched"); | 1200 LoadAndLaunchPlatformApp("web_view/shim", "Launched"); |
1203 | 1201 |
1204 content::WebContents* embedder_web_contents = GetFirstAppWindowWebContents(); | 1202 content::WebContents* embedder_web_contents = GetFirstAppWindowWebContents(); |
1205 ASSERT_TRUE(embedder_web_contents); | 1203 ASSERT_TRUE(embedder_web_contents); |
1206 | 1204 |
1207 GURL::Replacements replace_host; | 1205 GURL::Replacements replace_host; |
1208 std::string host_str("localhost"); // Must stay in scope with replace_host. | 1206 replace_host.SetHostStr("localhost"); |
1209 replace_host.SetHostStr(host_str); | |
1210 | 1207 |
1211 std::string guest_path( | 1208 std::string guest_path( |
1212 "/extensions/platform_apps/web_view/shim/empty_guest.html"); | 1209 "/extensions/platform_apps/web_view/shim/empty_guest.html"); |
1213 GURL guest_url = embedded_test_server()->GetURL(guest_path); | 1210 GURL guest_url = embedded_test_server()->GetURL(guest_path); |
1214 guest_url = guest_url.ReplaceComponents(replace_host); | 1211 guest_url = guest_url.ReplaceComponents(replace_host); |
1215 | 1212 |
1216 ui_test_utils::UrlLoadObserver guest_observer( | 1213 ui_test_utils::UrlLoadObserver guest_observer( |
1217 guest_url, content::NotificationService::AllSources()); | 1214 guest_url, content::NotificationService::AllSources()); |
1218 | 1215 |
1219 // Run the test and wait until the guest WebContents is available and has | 1216 // Run the test and wait until the guest WebContents is available and has |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1389 const std::string kExpire = | 1386 const std::string kExpire = |
1390 "var expire = new Date(Date.now() + 24 * 60 * 60 * 1000);"; | 1387 "var expire = new Date(Date.now() + 24 * 60 * 60 * 1000);"; |
1391 std::string cookie_script1(kExpire); | 1388 std::string cookie_script1(kExpire); |
1392 cookie_script1.append( | 1389 cookie_script1.append( |
1393 "document.cookie = 'guest1=true; path=/; expires=' + expire + ';';"); | 1390 "document.cookie = 'guest1=true; path=/; expires=' + expire + ';';"); |
1394 std::string cookie_script2(kExpire); | 1391 std::string cookie_script2(kExpire); |
1395 cookie_script2.append( | 1392 cookie_script2.append( |
1396 "document.cookie = 'guest2=true; path=/; expires=' + expire + ';';"); | 1393 "document.cookie = 'guest2=true; path=/; expires=' + expire + ';';"); |
1397 | 1394 |
1398 GURL::Replacements replace_host; | 1395 GURL::Replacements replace_host; |
1399 std::string host_str("localhost"); // Must stay in scope with replace_host. | 1396 replace_host.SetHostStr("localhost"); |
1400 replace_host.SetHostStr(host_str); | |
1401 | 1397 |
1402 GURL set_cookie_url = embedded_test_server()->GetURL( | 1398 GURL set_cookie_url = embedded_test_server()->GetURL( |
1403 "/extensions/platform_apps/isolation/set_cookie.html"); | 1399 "/extensions/platform_apps/isolation/set_cookie.html"); |
1404 set_cookie_url = set_cookie_url.ReplaceComponents(replace_host); | 1400 set_cookie_url = set_cookie_url.ReplaceComponents(replace_host); |
1405 | 1401 |
1406 // The first two partitions will be used to set cookies and ensure they are | 1402 // The first two partitions will be used to set cookies and ensure they are |
1407 // shared. The named partition is used to ensure that cookies are isolated | 1403 // shared. The named partition is used to ensure that cookies are isolated |
1408 // between partitions within the same app. | 1404 // between partitions within the same app. |
1409 content::WebContents* cookie_contents1; | 1405 content::WebContents* cookie_contents1; |
1410 content::WebContents* cookie_contents2; | 1406 content::WebContents* cookie_contents2; |
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2479 // http://crbug.com/403325 | 2475 // http://crbug.com/403325 |
2480 #define MAYBE_WebViewInBackgroundPage \ | 2476 #define MAYBE_WebViewInBackgroundPage \ |
2481 DISABLED_WebViewInBackgroundPage | 2477 DISABLED_WebViewInBackgroundPage |
2482 #else | 2478 #else |
2483 #define MAYBE_WebViewInBackgroundPage WebViewInBackgroundPage | 2479 #define MAYBE_WebViewInBackgroundPage WebViewInBackgroundPage |
2484 #endif | 2480 #endif |
2485 IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_WebViewInBackgroundPage) { | 2481 IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_WebViewInBackgroundPage) { |
2486 ASSERT_TRUE(RunExtensionTest("platform_apps/web_view/background")) | 2482 ASSERT_TRUE(RunExtensionTest("platform_apps/web_view/background")) |
2487 << message_; | 2483 << message_; |
2488 } | 2484 } |
OLD | NEW |