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/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
6 #include "chrome/browser/automation/automation_util.h" | 6 #include "chrome/browser/automation/automation_util.h" |
7 #include "chrome/browser/extensions/platform_app_browsertest_util.h" | 7 #include "chrome/browser/extensions/platform_app_browsertest_util.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 content::WebContents** persistent_partition_contents1, | 49 content::WebContents** persistent_partition_contents1, |
50 content::WebContents** persistent_partition_contents2, | 50 content::WebContents** persistent_partition_contents2, |
51 content::WebContents** persistent_partition_contents3) { | 51 content::WebContents** persistent_partition_contents3) { |
52 GURL::Replacements replace_host; | 52 GURL::Replacements replace_host; |
53 std::string host_str("localhost"); // Must stay in scope with replace_host. | 53 std::string host_str("localhost"); // Must stay in scope with replace_host. |
54 replace_host.SetHostStr(host_str); | 54 replace_host.SetHostStr(host_str); |
55 | 55 |
56 navigate_to_url = navigate_to_url.ReplaceComponents(replace_host); | 56 navigate_to_url = navigate_to_url.ReplaceComponents(replace_host); |
57 | 57 |
58 GURL tag_url1 = test_server()->GetURL( | 58 GURL tag_url1 = test_server()->GetURL( |
59 "files/extensions/platform_apps/web_view_isolation/cookie.html"); | 59 "files/extensions/platform_apps/web_view/isolation/cookie.html"); |
60 tag_url1 = tag_url1.ReplaceComponents(replace_host); | 60 tag_url1 = tag_url1.ReplaceComponents(replace_host); |
61 GURL tag_url2 = test_server()->GetURL( | 61 GURL tag_url2 = test_server()->GetURL( |
62 "files/extensions/platform_apps/web_view_isolation/cookie2.html"); | 62 "files/extensions/platform_apps/web_view/isolation/cookie2.html"); |
63 tag_url2 = tag_url2.ReplaceComponents(replace_host); | 63 tag_url2 = tag_url2.ReplaceComponents(replace_host); |
64 GURL tag_url3 = test_server()->GetURL( | 64 GURL tag_url3 = test_server()->GetURL( |
65 "files/extensions/platform_apps/web_view_isolation/storage1.html"); | 65 "files/extensions/platform_apps/web_view/isolation/storage1.html"); |
66 tag_url3 = tag_url3.ReplaceComponents(replace_host); | 66 tag_url3 = tag_url3.ReplaceComponents(replace_host); |
67 GURL tag_url4 = test_server()->GetURL( | 67 GURL tag_url4 = test_server()->GetURL( |
68 "files/extensions/platform_apps/web_view_isolation/storage2.html"); | 68 "files/extensions/platform_apps/web_view/isolation/storage2.html"); |
69 tag_url4 = tag_url4.ReplaceComponents(replace_host); | 69 tag_url4 = tag_url4.ReplaceComponents(replace_host); |
70 GURL tag_url5 = test_server()->GetURL( | 70 GURL tag_url5 = test_server()->GetURL( |
71 "files/extensions/platform_apps/web_view_isolation/storage1.html#p1"); | 71 "files/extensions/platform_apps/web_view/isolation/storage1.html#p1"); |
72 tag_url5 = tag_url5.ReplaceComponents(replace_host); | 72 tag_url5 = tag_url5.ReplaceComponents(replace_host); |
73 GURL tag_url6 = test_server()->GetURL( | 73 GURL tag_url6 = test_server()->GetURL( |
74 "files/extensions/platform_apps/web_view_isolation/storage1.html#p2"); | 74 "files/extensions/platform_apps/web_view/isolation/storage1.html#p2"); |
75 tag_url6 = tag_url6.ReplaceComponents(replace_host); | 75 tag_url6 = tag_url6.ReplaceComponents(replace_host); |
76 GURL tag_url7 = test_server()->GetURL( | 76 GURL tag_url7 = test_server()->GetURL( |
77 "files/extensions/platform_apps/web_view_isolation/storage1.html#p3"); | 77 "files/extensions/platform_apps/web_view/isolation/storage1.html#p3"); |
78 tag_url7 = tag_url7.ReplaceComponents(replace_host); | 78 tag_url7 = tag_url7.ReplaceComponents(replace_host); |
79 | 79 |
80 ui_test_utils::NavigateToURLWithDisposition( | 80 ui_test_utils::NavigateToURLWithDisposition( |
81 browser(), navigate_to_url, CURRENT_TAB, | 81 browser(), navigate_to_url, CURRENT_TAB, |
82 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 82 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
83 | 83 |
84 ui_test_utils::UrlLoadObserver observer1( | 84 ui_test_utils::UrlLoadObserver observer1( |
85 tag_url1, content::NotificationService::AllSources()); | 85 tag_url1, content::NotificationService::AllSources()); |
86 ui_test_utils::UrlLoadObserver observer2( | 86 ui_test_utils::UrlLoadObserver observer2( |
87 tag_url2, content::NotificationService::AllSources()); | 87 tag_url2, content::NotificationService::AllSources()); |
88 ui_test_utils::UrlLoadObserver observer3( | 88 ui_test_utils::UrlLoadObserver observer3( |
89 tag_url3, content::NotificationService::AllSources()); | 89 tag_url3, content::NotificationService::AllSources()); |
90 ui_test_utils::UrlLoadObserver observer4( | 90 ui_test_utils::UrlLoadObserver observer4( |
91 tag_url4, content::NotificationService::AllSources()); | 91 tag_url4, content::NotificationService::AllSources()); |
92 ui_test_utils::UrlLoadObserver observer5( | 92 ui_test_utils::UrlLoadObserver observer5( |
93 tag_url5, content::NotificationService::AllSources()); | 93 tag_url5, content::NotificationService::AllSources()); |
94 ui_test_utils::UrlLoadObserver observer6( | 94 ui_test_utils::UrlLoadObserver observer6( |
95 tag_url6, content::NotificationService::AllSources()); | 95 tag_url6, content::NotificationService::AllSources()); |
96 ui_test_utils::UrlLoadObserver observer7( | 96 ui_test_utils::UrlLoadObserver observer7( |
97 tag_url7, content::NotificationService::AllSources()); | 97 tag_url7, content::NotificationService::AllSources()); |
98 LoadAndLaunchPlatformApp("web_view_isolation"); | 98 LoadAndLaunchPlatformApp("web_view/isolation"); |
99 observer1.Wait(); | 99 observer1.Wait(); |
100 observer2.Wait(); | 100 observer2.Wait(); |
101 observer3.Wait(); | 101 observer3.Wait(); |
102 observer4.Wait(); | 102 observer4.Wait(); |
103 observer5.Wait(); | 103 observer5.Wait(); |
104 observer6.Wait(); | 104 observer6.Wait(); |
105 observer7.Wait(); | 105 observer7.Wait(); |
106 | 106 |
107 content::Source<content::NavigationController> source1 = observer1.source(); | 107 content::Source<content::NavigationController> source1 = observer1.source(); |
108 EXPECT_TRUE(source1->GetWebContents()->GetRenderProcessHost()->IsGuest()); | 108 EXPECT_TRUE(source1->GetWebContents()->GetRenderProcessHost()->IsGuest()); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 string16 error_title(ASCIIToUTF16("error")); | 198 string16 error_title(ASCIIToUTF16("error")); |
199 | 199 |
200 content::TitleWatcher title_watcher(web_contents, expected_title); | 200 content::TitleWatcher title_watcher(web_contents, expected_title); |
201 title_watcher.AlsoWaitForTitle(error_title); | 201 title_watcher.AlsoWaitForTitle(error_title); |
202 EXPECT_TRUE(content::ExecuteScript(web_contents, script)); | 202 EXPECT_TRUE(content::ExecuteScript(web_contents, script)); |
203 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 203 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
204 } | 204 } |
205 }; | 205 }; |
206 | 206 |
207 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim) { | 207 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim) { |
208 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view")) << message_; | 208 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/shim")) << message_; |
209 } | 209 } |
210 | 210 |
211 IN_PROC_BROWSER_TEST_F(WebViewTest, ShimSrcAttribute) { | 211 IN_PROC_BROWSER_TEST_F(WebViewTest, ShimSrcAttribute) { |
212 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view_src_attribute")) | 212 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/src_attribute")) |
213 << message_; | 213 << message_; |
214 } | 214 } |
215 | 215 |
216 // This tests cookie isolation for packaged apps with webview tags. It navigates | 216 // This tests cookie isolation for packaged apps with webview tags. It navigates |
217 // the main browser window to a page that sets a cookie and loads an app with | 217 // the main browser window to a page that sets a cookie and loads an app with |
218 // multiple webview tags. Each tag sets a cookie and the test checks the proper | 218 // multiple webview tags. Each tag sets a cookie and the test checks the proper |
219 // storage isolation is enforced. | 219 // storage isolation is enforced. |
220 IN_PROC_BROWSER_TEST_F(WebViewTest, CookieIsolation) { | 220 IN_PROC_BROWSER_TEST_F(WebViewTest, CookieIsolation) { |
221 ASSERT_TRUE(StartTestServer()); | 221 ASSERT_TRUE(StartTestServer()); |
222 const std::string kExpire = | 222 const std::string kExpire = |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 "indexedDB.open('isolation').onsuccess = function(e) {" | 588 "indexedDB.open('isolation').onsuccess = function(e) {" |
589 " if (e.target.result.version == 1)" | 589 " if (e.target.result.version == 1)" |
590 " document.title = 'db not found';" | 590 " document.title = 'db not found';" |
591 " else " | 591 " else " |
592 " document.title = 'error';" | 592 " document.title = 'error';" |
593 "}"; | 593 "}"; |
594 ExecuteScriptWaitForTitle(browser()->tab_strip_model()->GetWebContentsAt(0), | 594 ExecuteScriptWaitForTitle(browser()->tab_strip_model()->GetWebContentsAt(0), |
595 script, "db not found"); | 595 script, "db not found"); |
596 ExecuteScriptWaitForTitle(default_tag_contents1, script, "db not found"); | 596 ExecuteScriptWaitForTitle(default_tag_contents1, script, "db not found"); |
597 } | 597 } |
OLD | NEW |