Chromium Code Reviews| 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_tabstrip.h" | 8 #include "chrome/browser/ui/browser_tabstrip.h" |
| 9 #include "chrome/test/base/ui_test_utils.h" | 9 #include "chrome/test/base/ui_test_utils.h" |
| 10 #include "chrome/test/base/test_launcher_utils.h" | 10 #include "chrome/test/base/test_launcher_utils.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 automation_util::GetCookies(GURL("http://localhost"), | 198 automation_util::GetCookies(GURL("http://localhost"), |
| 199 cookie_contents2, | 199 cookie_contents2, |
| 200 &cookie_size, &cookie_value); | 200 &cookie_size, &cookie_value); |
| 201 EXPECT_EQ("guest1=true; guest2=true", cookie_value); | 201 EXPECT_EQ("guest1=true; guest2=true", cookie_value); |
| 202 | 202 |
| 203 // The third tag should not have any cookies as it is in a separate partition. | 203 // The third tag should not have any cookies as it is in a separate partition. |
| 204 automation_util::GetCookies(GURL("http://localhost"), | 204 automation_util::GetCookies(GURL("http://localhost"), |
| 205 named_partition_contents1, | 205 named_partition_contents1, |
| 206 &cookie_size, &cookie_value); | 206 &cookie_size, &cookie_value); |
| 207 EXPECT_EQ("", cookie_value); | 207 EXPECT_EQ("", cookie_value); |
| 208 | |
| 209 CloseShellWindowsAndWaitForAppToExit(); | |
|
davidjames
2012/11/08 17:38:48
The original CL had trivial conflicts on this line
| |
| 210 } | 208 } |
| 211 | 209 |
| 212 // This tests DOM storage isolation for packaged apps with webview tags. It | 210 // This tests DOM storage isolation for packaged apps with webview tags. It |
| 213 // loads an app with multiple webview tags and each tag sets DOM storage | 211 // loads an app with multiple webview tags and each tag sets DOM storage |
| 214 // entries, which the test checks to ensure proper storage isolation is | 212 // entries, which the test checks to ensure proper storage isolation is |
| 215 // enforced. | 213 // enforced. |
| 216 IN_PROC_BROWSER_TEST_F(WebViewTest, DOMStorageIsolation) { | 214 IN_PROC_BROWSER_TEST_F(WebViewTest, DOMStorageIsolation) { |
| 217 ASSERT_TRUE(StartTestServer()); | 215 ASSERT_TRUE(StartTestServer()); |
| 218 GURL regular_url = test_server()->GetURL("files/title1.html"); | 216 GURL regular_url = test_server()->GetURL("files/title1.html"); |
| 219 | 217 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 288 std::wstring(), get_session_storage.c_str(), &output)); | 286 std::wstring(), get_session_storage.c_str(), &output)); |
| 289 EXPECT_STREQ("badval", output.c_str()); | 287 EXPECT_STREQ("badval", output.c_str()); |
| 290 EXPECT_TRUE(ExecuteJavaScriptAndExtractString( | 288 EXPECT_TRUE(ExecuteJavaScriptAndExtractString( |
| 291 default_tag_contents1->GetRenderViewHost(), std::wstring(), | 289 default_tag_contents1->GetRenderViewHost(), std::wstring(), |
| 292 get_local_storage.c_str(), &output)); | 290 get_local_storage.c_str(), &output)); |
| 293 EXPECT_STREQ("badval", output.c_str()); | 291 EXPECT_STREQ("badval", output.c_str()); |
| 294 EXPECT_TRUE(ExecuteJavaScriptAndExtractString( | 292 EXPECT_TRUE(ExecuteJavaScriptAndExtractString( |
| 295 default_tag_contents1->GetRenderViewHost(), std::wstring(), | 293 default_tag_contents1->GetRenderViewHost(), std::wstring(), |
| 296 get_session_storage.c_str(), &output)); | 294 get_session_storage.c_str(), &output)); |
| 297 EXPECT_STREQ("badval", output.c_str()); | 295 EXPECT_STREQ("badval", output.c_str()); |
| 298 | |
| 299 CloseShellWindowsAndWaitForAppToExit(); | |
|
davidjames
2012/11/08 17:38:48
The CL I reverted added the CloseShellWindowsAndWa
| |
| 300 } | 296 } |
| 301 | 297 |
| 302 // This tests IndexedDB isolation for packaged apps with webview tags. It loads | 298 // This tests IndexedDB isolation for packaged apps with webview tags. It loads |
| 303 // an app with multiple webview tags and each tag creates an IndexedDB record, | 299 // an app with multiple webview tags and each tag creates an IndexedDB record, |
| 304 // which the test checks to ensure proper storage isolation is enforced. | 300 // which the test checks to ensure proper storage isolation is enforced. |
| 305 IN_PROC_BROWSER_TEST_F(WebViewTest, IndexedDBIsolation) { | 301 IN_PROC_BROWSER_TEST_F(WebViewTest, IndexedDBIsolation) { |
| 306 ASSERT_TRUE(StartTestServer()); | 302 ASSERT_TRUE(StartTestServer()); |
| 307 GURL regular_url = test_server()->GetURL("files/title1.html"); | 303 GURL regular_url = test_server()->GetURL("files/title1.html"); |
| 308 | 304 |
| 309 content::WebContents* default_tag_contents1; | 305 content::WebContents* default_tag_contents1; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 const char* script = | 372 const char* script = |
| 377 "indexedDB.open('isolation').onsuccess = function(e) {" | 373 "indexedDB.open('isolation').onsuccess = function(e) {" |
| 378 " if (e.target.result.version == 1)" | 374 " if (e.target.result.version == 1)" |
| 379 " document.title = 'db not found';" | 375 " document.title = 'db not found';" |
| 380 " else " | 376 " else " |
| 381 " document.title = 'error';" | 377 " document.title = 'error';" |
| 382 "}"; | 378 "}"; |
| 383 ExecuteScriptWaitForTitle(chrome::GetWebContentsAt(browser(), 0), | 379 ExecuteScriptWaitForTitle(chrome::GetWebContentsAt(browser(), 0), |
| 384 script, "db not found"); | 380 script, "db not found"); |
| 385 ExecuteScriptWaitForTitle(default_tag_contents1, script, "db not found"); | 381 ExecuteScriptWaitForTitle(default_tag_contents1, script, "db not found"); |
| 386 | |
| 387 CloseShellWindowsAndWaitForAppToExit(); | |
|
davidjames
2012/11/08 17:38:48
The CL I reverted added the CloseShellWindowsAndWa
| |
| 388 } | 382 } |
| OLD | NEW |