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

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

Issue 11117011: Keep browser process alive while there are platform apps with background pages running. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update new sync tests 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();
285 } 287 }
286 288
287 // This tests that in-memory storage partitions are reset on browser restart, 289 // This tests that in-memory storage partitions are reset on browser restart,
288 // but persistent ones maintain state for cookies and HTML5 storage. 290 // but persistent ones maintain state for cookies and HTML5 storage.
289 IN_PROC_BROWSER_TEST_F(WebViewTest, PRE_StoragePersistence) { 291 IN_PROC_BROWSER_TEST_F(WebViewTest, PRE_StoragePersistence) {
290 ASSERT_TRUE(StartTestServer()); 292 ASSERT_TRUE(StartTestServer());
291 const std::wstring kExpire = 293 const std::wstring kExpire =
292 L"var expire = new Date(Date.now() + 24 * 60 * 60 * 1000);"; 294 L"var expire = new Date(Date.now() + 24 * 60 * 60 * 1000);";
293 std::wstring cookie_script1(kExpire); 295 std::wstring cookie_script1(kExpire);
294 cookie_script1.append( 296 cookie_script1.append(
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 &cookie_size, &cookie_value); 367 &cookie_size, &cookie_value);
366 EXPECT_EQ("persist1=true", cookie_value); 368 EXPECT_EQ("persist1=true", cookie_value);
367 automation_util::GetCookies(GURL("http://localhost"), 369 automation_util::GetCookies(GURL("http://localhost"),
368 persistent_partition_contents2, 370 persistent_partition_contents2,
369 &cookie_size, &cookie_value); 371 &cookie_size, &cookie_value);
370 EXPECT_EQ("persist1=true", cookie_value); 372 EXPECT_EQ("persist1=true", cookie_value);
371 automation_util::GetCookies(GURL("http://localhost"), 373 automation_util::GetCookies(GURL("http://localhost"),
372 persistent_partition_contents3, 374 persistent_partition_contents3,
373 &cookie_size, &cookie_value); 375 &cookie_size, &cookie_value);
374 EXPECT_EQ("persist2=true", cookie_value); 376 EXPECT_EQ("persist2=true", cookie_value);
377
378 CloseShellWindowsAndWaitForAppToExit();
375 } 379 }
376 380
377 // This is the post-reset portion of the StoragePersistence test. See 381 // This is the post-reset portion of the StoragePersistence test. See
378 // PRE_StoragePersistence for main comment. 382 // PRE_StoragePersistence for main comment.
379 IN_PROC_BROWSER_TEST_F(WebViewTest, StoragePersistence) { 383 IN_PROC_BROWSER_TEST_F(WebViewTest, StoragePersistence) {
380 ASSERT_TRUE(StartTestServer()); 384 ASSERT_TRUE(StartTestServer());
381 385
382 // We don't care where the main browser is on this test. 386 // We don't care where the main browser is on this test.
383 GURL blank_url("about:blank"); 387 GURL blank_url("about:blank");
384 388
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 &cookie_size, &cookie_value); 430 &cookie_size, &cookie_value);
427 EXPECT_EQ("persist1=true", cookie_value); 431 EXPECT_EQ("persist1=true", cookie_value);
428 automation_util::GetCookies(GURL("http://localhost"), 432 automation_util::GetCookies(GURL("http://localhost"),
429 persistent_partition_contents2, 433 persistent_partition_contents2,
430 &cookie_size, &cookie_value); 434 &cookie_size, &cookie_value);
431 EXPECT_EQ("persist1=true", cookie_value); 435 EXPECT_EQ("persist1=true", cookie_value);
432 automation_util::GetCookies(GURL("http://localhost"), 436 automation_util::GetCookies(GURL("http://localhost"),
433 persistent_partition_contents3, 437 persistent_partition_contents3,
434 &cookie_size, &cookie_value); 438 &cookie_size, &cookie_value);
435 EXPECT_EQ("persist2=true", cookie_value); 439 EXPECT_EQ("persist2=true", cookie_value);
440
441 CloseShellWindowsAndWaitForAppToExit();
436 } 442 }
437 443
438 // This tests DOM storage isolation for packaged apps with webview tags. It 444 // This tests DOM storage isolation for packaged apps with webview tags. It
439 // loads an app with multiple webview tags and each tag sets DOM storage 445 // loads an app with multiple webview tags and each tag sets DOM storage
440 // entries, which the test checks to ensure proper storage isolation is 446 // entries, which the test checks to ensure proper storage isolation is
441 // enforced. 447 // enforced.
442 IN_PROC_BROWSER_TEST_F(WebViewTest, DOMStorageIsolation) { 448 IN_PROC_BROWSER_TEST_F(WebViewTest, DOMStorageIsolation) {
443 ASSERT_TRUE(StartTestServer()); 449 ASSERT_TRUE(StartTestServer());
444 GURL regular_url = test_server()->GetURL("files/title1.html"); 450 GURL regular_url = test_server()->GetURL("files/title1.html");
445 451
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 std::wstring(), get_session_storage.c_str(), &output)); 520 std::wstring(), get_session_storage.c_str(), &output));
515 EXPECT_STREQ("badval", output.c_str()); 521 EXPECT_STREQ("badval", output.c_str());
516 EXPECT_TRUE(ExecuteJavaScriptAndExtractString( 522 EXPECT_TRUE(ExecuteJavaScriptAndExtractString(
517 default_tag_contents1->GetRenderViewHost(), std::wstring(), 523 default_tag_contents1->GetRenderViewHost(), std::wstring(),
518 get_local_storage.c_str(), &output)); 524 get_local_storage.c_str(), &output));
519 EXPECT_STREQ("badval", output.c_str()); 525 EXPECT_STREQ("badval", output.c_str());
520 EXPECT_TRUE(ExecuteJavaScriptAndExtractString( 526 EXPECT_TRUE(ExecuteJavaScriptAndExtractString(
521 default_tag_contents1->GetRenderViewHost(), std::wstring(), 527 default_tag_contents1->GetRenderViewHost(), std::wstring(),
522 get_session_storage.c_str(), &output)); 528 get_session_storage.c_str(), &output));
523 EXPECT_STREQ("badval", output.c_str()); 529 EXPECT_STREQ("badval", output.c_str());
530
531 CloseShellWindowsAndWaitForAppToExit();
524 } 532 }
525 533
526 // This tests IndexedDB isolation for packaged apps with webview tags. It loads 534 // This tests IndexedDB isolation for packaged apps with webview tags. It loads
527 // an app with multiple webview tags and each tag creates an IndexedDB record, 535 // an app with multiple webview tags and each tag creates an IndexedDB record,
528 // which the test checks to ensure proper storage isolation is enforced. 536 // which the test checks to ensure proper storage isolation is enforced.
529 IN_PROC_BROWSER_TEST_F(WebViewTest, IndexedDBIsolation) { 537 IN_PROC_BROWSER_TEST_F(WebViewTest, IndexedDBIsolation) {
530 ASSERT_TRUE(StartTestServer()); 538 ASSERT_TRUE(StartTestServer());
531 GURL regular_url = test_server()->GetURL("files/title1.html"); 539 GURL regular_url = test_server()->GetURL("files/title1.html");
532 540
533 content::WebContents* default_tag_contents1; 541 content::WebContents* default_tag_contents1;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 const char* script = 608 const char* script =
601 "indexedDB.open('isolation').onsuccess = function(e) {" 609 "indexedDB.open('isolation').onsuccess = function(e) {"
602 " if (e.target.result.version == 1)" 610 " if (e.target.result.version == 1)"
603 " document.title = 'db not found';" 611 " document.title = 'db not found';"
604 " else " 612 " else "
605 " document.title = 'error';" 613 " document.title = 'error';"
606 "}"; 614 "}";
607 ExecuteScriptWaitForTitle(chrome::GetWebContentsAt(browser(), 0), 615 ExecuteScriptWaitForTitle(chrome::GetWebContentsAt(browser(), 0),
608 script, "db not found"); 616 script, "db not found");
609 ExecuteScriptWaitForTitle(default_tag_contents1, script, "db not found"); 617 ExecuteScriptWaitForTitle(default_tag_contents1, script, "db not found");
618
619 CloseShellWindowsAndWaitForAppToExit();
610 } 620 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698