| 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 | 315 |
| 316 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest, | 316 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest, |
| 317 PRE_LocalStorageClearedOnExit) { | 317 PRE_LocalStorageClearedOnExit) { |
| 318 // Normally localStorage is restored. | 318 // Normally localStorage is restored. |
| 319 CheckReloadedPageRestored(); | 319 CheckReloadedPageRestored(); |
| 320 // ... but not if it's set to clear on exit. | 320 // ... but not if it's set to clear on exit. |
| 321 CookieSettings::Factory::GetForProfile(browser()->profile())-> | 321 CookieSettings::Factory::GetForProfile(browser()->profile())-> |
| 322 SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); | 322 SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); |
| 323 } | 323 } |
| 324 | 324 |
| 325 // Flaky on Linux: http://crbug.com/163096 | 325 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest, LocalStorageClearedOnExit) { |
| 326 #if defined(OS_LINUX) | |
| 327 #define MAYBE_LocalStorageClearedOnExit DISABLED_LocalStorageClearedOnExit | |
| 328 #else | |
| 329 #define MAYBE_LocalStorageClearedOnExit LocalStorageClearedOnExit | |
| 330 #endif | |
| 331 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest, | |
| 332 MAYBE_LocalStorageClearedOnExit) { | |
| 333 CheckReloadedPageNotRestored(); | 326 CheckReloadedPageNotRestored(); |
| 334 } | 327 } |
| 335 | 328 |
| 336 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest, | 329 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest, |
| 337 PRE_PRE_CookiesClearedOnExit) { | 330 PRE_PRE_CookiesClearedOnExit) { |
| 338 StoreDataWithPage("cookies.html"); | 331 StoreDataWithPage("cookies.html"); |
| 339 } | 332 } |
| 340 | 333 |
| 341 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest, PRE_CookiesClearedOnExit) { | 334 IN_PROC_BROWSER_TEST_F(ContinueWhereILeftOffTest, PRE_CookiesClearedOnExit) { |
| 342 // Normally cookies are restored. | 335 // Normally cookies are restored. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, PRE_LocalStorageClearedOnExit) { | 488 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, PRE_LocalStorageClearedOnExit) { |
| 496 // Normally localStorage is persisted. | 489 // Normally localStorage is persisted. |
| 497 content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); | 490 content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); |
| 498 EXPECT_EQ(std::string(chrome::kAboutBlankURL), web_contents->GetURL().spec()); | 491 EXPECT_EQ(std::string(chrome::kAboutBlankURL), web_contents->GetURL().spec()); |
| 499 NavigateAndCheckStoredData("local_storage.html"); | 492 NavigateAndCheckStoredData("local_storage.html"); |
| 500 // ... but not if it's set to clear on exit. | 493 // ... but not if it's set to clear on exit. |
| 501 CookieSettings::Factory::GetForProfile(browser()->profile())-> | 494 CookieSettings::Factory::GetForProfile(browser()->profile())-> |
| 502 SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); | 495 SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); |
| 503 } | 496 } |
| 504 | 497 |
| 505 // See flakiness comment above. | 498 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, LocalStorageClearedOnExit) { |
| 506 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, MAYBE_LocalStorageClearedOnExit) { | |
| 507 content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); | 499 content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); |
| 508 EXPECT_EQ(std::string(chrome::kAboutBlankURL), web_contents->GetURL().spec()); | 500 EXPECT_EQ(std::string(chrome::kAboutBlankURL), web_contents->GetURL().spec()); |
| 509 StoreDataWithPage("local_storage.html"); | 501 StoreDataWithPage("local_storage.html"); |
| 510 } | 502 } |
| 511 | 503 |
| 512 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, PRE_PRE_CookiesClearedOnExit) { | 504 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, PRE_PRE_CookiesClearedOnExit) { |
| 513 StoreDataWithPage("cookies.html"); | 505 StoreDataWithPage("cookies.html"); |
| 514 } | 506 } |
| 515 | 507 |
| 516 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, PRE_CookiesClearedOnExit) { | 508 IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, PRE_CookiesClearedOnExit) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 CheckReloadedPageRestored(browser_after_restore); | 587 CheckReloadedPageRestored(browser_after_restore); |
| 596 } | 588 } |
| 597 | 589 |
| 598 private: | 590 private: |
| 599 DISALLOW_COPY_AND_ASSIGN(BetterSessionRestoreCrashTest); | 591 DISALLOW_COPY_AND_ASSIGN(BetterSessionRestoreCrashTest); |
| 600 }; | 592 }; |
| 601 | 593 |
| 602 IN_PROC_BROWSER_TEST_F(BetterSessionRestoreCrashTest, SessionCookies) { | 594 IN_PROC_BROWSER_TEST_F(BetterSessionRestoreCrashTest, SessionCookies) { |
| 603 CrashTestWithPage("session_cookies.html"); | 595 CrashTestWithPage("session_cookies.html"); |
| 604 } | 596 } |
| OLD | NEW |