Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: chrome/browser/extensions/web_view_browsertest.cc

Issue 11299326: Revert 170660 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 automation_util::GetCookies(GURL("http://localhost"), 275 automation_util::GetCookies(GURL("http://localhost"),
276 cookie_contents2, 276 cookie_contents2,
277 &cookie_size, &cookie_value); 277 &cookie_size, &cookie_value);
278 EXPECT_EQ("guest1=true; guest2=true", cookie_value); 278 EXPECT_EQ("guest1=true; guest2=true", cookie_value);
279 279
280 // The third tag should not have any cookies as it is in a separate partition. 280 // The third tag should not have any cookies as it is in a separate partition.
281 automation_util::GetCookies(GURL("http://localhost"), 281 automation_util::GetCookies(GURL("http://localhost"),
282 named_partition_contents1, 282 named_partition_contents1,
283 &cookie_size, &cookie_value); 283 &cookie_size, &cookie_value);
284 EXPECT_EQ("", cookie_value); 284 EXPECT_EQ("", cookie_value);
285
286 CloseShellWindowsAndWaitForAppToExit();
287 } 285 }
288 286
289 // This tests that in-memory storage partitions are reset on browser restart, 287 // This tests that in-memory storage partitions are reset on browser restart,
290 // but persistent ones maintain state for cookies and HTML5 storage. 288 // but persistent ones maintain state for cookies and HTML5 storage.
291 IN_PROC_BROWSER_TEST_F(WebViewTest, PRE_StoragePersistence) { 289 IN_PROC_BROWSER_TEST_F(WebViewTest, PRE_StoragePersistence) {
292 ASSERT_TRUE(StartTestServer()); 290 ASSERT_TRUE(StartTestServer());
293 const std::wstring kExpire = 291 const std::wstring kExpire =
294 L"var expire = new Date(Date.now() + 24 * 60 * 60 * 1000);"; 292 L"var expire = new Date(Date.now() + 24 * 60 * 60 * 1000);";
295 std::wstring cookie_script1(kExpire); 293 std::wstring cookie_script1(kExpire);
296 cookie_script1.append( 294 cookie_script1.append(
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 &cookie_size, &cookie_value); 365 &cookie_size, &cookie_value);
368 EXPECT_EQ("persist1=true", cookie_value); 366 EXPECT_EQ("persist1=true", cookie_value);
369 automation_util::GetCookies(GURL("http://localhost"), 367 automation_util::GetCookies(GURL("http://localhost"),
370 persistent_partition_contents2, 368 persistent_partition_contents2,
371 &cookie_size, &cookie_value); 369 &cookie_size, &cookie_value);
372 EXPECT_EQ("persist1=true", cookie_value); 370 EXPECT_EQ("persist1=true", cookie_value);
373 automation_util::GetCookies(GURL("http://localhost"), 371 automation_util::GetCookies(GURL("http://localhost"),
374 persistent_partition_contents3, 372 persistent_partition_contents3,
375 &cookie_size, &cookie_value); 373 &cookie_size, &cookie_value);
376 EXPECT_EQ("persist2=true", cookie_value); 374 EXPECT_EQ("persist2=true", cookie_value);
377
378 CloseShellWindowsAndWaitForAppToExit();
379 } 375 }
380 376
381 // This is the post-reset portion of the StoragePersistence test. See 377 // This is the post-reset portion of the StoragePersistence test. See
382 // PRE_StoragePersistence for main comment. 378 // PRE_StoragePersistence for main comment.
383 IN_PROC_BROWSER_TEST_F(WebViewTest, StoragePersistence) { 379 IN_PROC_BROWSER_TEST_F(WebViewTest, StoragePersistence) {
384 ASSERT_TRUE(StartTestServer()); 380 ASSERT_TRUE(StartTestServer());
385 381
386 // We don't care where the main browser is on this test. 382 // We don't care where the main browser is on this test.
387 GURL blank_url("about:blank"); 383 GURL blank_url("about:blank");
388 384
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 &cookie_size, &cookie_value); 426 &cookie_size, &cookie_value);
431 EXPECT_EQ("persist1=true", cookie_value); 427 EXPECT_EQ("persist1=true", cookie_value);
432 automation_util::GetCookies(GURL("http://localhost"), 428 automation_util::GetCookies(GURL("http://localhost"),
433 persistent_partition_contents2, 429 persistent_partition_contents2,
434 &cookie_size, &cookie_value); 430 &cookie_size, &cookie_value);
435 EXPECT_EQ("persist1=true", cookie_value); 431 EXPECT_EQ("persist1=true", cookie_value);
436 automation_util::GetCookies(GURL("http://localhost"), 432 automation_util::GetCookies(GURL("http://localhost"),
437 persistent_partition_contents3, 433 persistent_partition_contents3,
438 &cookie_size, &cookie_value); 434 &cookie_size, &cookie_value);
439 EXPECT_EQ("persist2=true", cookie_value); 435 EXPECT_EQ("persist2=true", cookie_value);
440
441 CloseShellWindowsAndWaitForAppToExit();
442 } 436 }
443 437
444 // This tests DOM storage isolation for packaged apps with webview tags. It 438 // This tests DOM storage isolation for packaged apps with webview tags. It
445 // loads an app with multiple webview tags and each tag sets DOM storage 439 // loads an app with multiple webview tags and each tag sets DOM storage
446 // entries, which the test checks to ensure proper storage isolation is 440 // entries, which the test checks to ensure proper storage isolation is
447 // enforced. 441 // enforced.
448 IN_PROC_BROWSER_TEST_F(WebViewTest, DOMStorageIsolation) { 442 IN_PROC_BROWSER_TEST_F(WebViewTest, DOMStorageIsolation) {
449 ASSERT_TRUE(StartTestServer()); 443 ASSERT_TRUE(StartTestServer());
450 GURL regular_url = test_server()->GetURL("files/title1.html"); 444 GURL regular_url = test_server()->GetURL("files/title1.html");
451 445
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 std::wstring(), get_session_storage.c_str(), &output)); 514 std::wstring(), get_session_storage.c_str(), &output));
521 EXPECT_STREQ("badval", output.c_str()); 515 EXPECT_STREQ("badval", output.c_str());
522 EXPECT_TRUE(ExecuteJavaScriptAndExtractString( 516 EXPECT_TRUE(ExecuteJavaScriptAndExtractString(
523 default_tag_contents1->GetRenderViewHost(), std::wstring(), 517 default_tag_contents1->GetRenderViewHost(), std::wstring(),
524 get_local_storage.c_str(), &output)); 518 get_local_storage.c_str(), &output));
525 EXPECT_STREQ("badval", output.c_str()); 519 EXPECT_STREQ("badval", output.c_str());
526 EXPECT_TRUE(ExecuteJavaScriptAndExtractString( 520 EXPECT_TRUE(ExecuteJavaScriptAndExtractString(
527 default_tag_contents1->GetRenderViewHost(), std::wstring(), 521 default_tag_contents1->GetRenderViewHost(), std::wstring(),
528 get_session_storage.c_str(), &output)); 522 get_session_storage.c_str(), &output));
529 EXPECT_STREQ("badval", output.c_str()); 523 EXPECT_STREQ("badval", output.c_str());
530
531 CloseShellWindowsAndWaitForAppToExit();
532 } 524 }
533 525
534 // This tests IndexedDB isolation for packaged apps with webview tags. It loads 526 // This tests IndexedDB isolation for packaged apps with webview tags. It loads
535 // an app with multiple webview tags and each tag creates an IndexedDB record, 527 // an app with multiple webview tags and each tag creates an IndexedDB record,
536 // which the test checks to ensure proper storage isolation is enforced. 528 // which the test checks to ensure proper storage isolation is enforced.
537 IN_PROC_BROWSER_TEST_F(WebViewTest, IndexedDBIsolation) { 529 IN_PROC_BROWSER_TEST_F(WebViewTest, IndexedDBIsolation) {
538 ASSERT_TRUE(StartTestServer()); 530 ASSERT_TRUE(StartTestServer());
539 GURL regular_url = test_server()->GetURL("files/title1.html"); 531 GURL regular_url = test_server()->GetURL("files/title1.html");
540 532
541 content::WebContents* default_tag_contents1; 533 content::WebContents* default_tag_contents1;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 const char* script = 600 const char* script =
609 "indexedDB.open('isolation').onsuccess = function(e) {" 601 "indexedDB.open('isolation').onsuccess = function(e) {"
610 " if (e.target.result.version == 1)" 602 " if (e.target.result.version == 1)"
611 " document.title = 'db not found';" 603 " document.title = 'db not found';"
612 " else " 604 " else "
613 " document.title = 'error';" 605 " document.title = 'error';"
614 "}"; 606 "}";
615 ExecuteScriptWaitForTitle(chrome::GetWebContentsAt(browser(), 0), 607 ExecuteScriptWaitForTitle(chrome::GetWebContentsAt(browser(), 0),
616 script, "db not found"); 608 script, "db not found");
617 ExecuteScriptWaitForTitle(default_tag_contents1, script, "db not found"); 609 ExecuteScriptWaitForTitle(default_tag_contents1, script, "db not found");
618
619 CloseShellWindowsAndWaitForAppToExit();
620 } 610 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/platform_app_service_factory.cc ('k') | chrome/browser/profiles/profile_dependency_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698