| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_path.h" | 5 #include "base/file_path.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "content/browser/browser_thread_impl.h" |
| 7 #include "content/browser/in_process_webkit/webkit_context.h" | 8 #include "content/browser/in_process_webkit/webkit_context.h" |
| 8 #include "content/test/test_browser_context.h" | 9 #include "content/test/test_browser_context.h" |
| 9 #include "content/test/test_browser_thread.h" | |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "webkit/quota/mock_special_storage_policy.h" | 11 #include "webkit/quota/mock_special_storage_policy.h" |
| 12 | 12 |
| 13 using content::BrowserThreadImpl; |
| 14 |
| 13 class DOMStorageTest : public testing::Test { | 15 class DOMStorageTest : public testing::Test { |
| 14 public: | 16 public: |
| 15 DOMStorageTest() | 17 DOMStorageTest() |
| 16 : message_loop_(MessageLoop::TYPE_IO), | 18 : message_loop_(MessageLoop::TYPE_IO), |
| 17 webkit_thread_(BrowserThread::WEBKIT, &message_loop_) { | 19 webkit_thread_(BrowserThread::WEBKIT, &message_loop_) { |
| 18 } | 20 } |
| 19 | 21 |
| 20 protected: | 22 protected: |
| 21 MessageLoop message_loop_; | 23 MessageLoop message_loop_; |
| 22 | 24 |
| 23 private: | 25 private: |
| 24 content::TestBrowserThread webkit_thread_; | 26 BrowserThreadImpl webkit_thread_; |
| 25 }; | 27 }; |
| 26 | 28 |
| 27 TEST_F(DOMStorageTest, SessionOnly) { | 29 TEST_F(DOMStorageTest, SessionOnly) { |
| 28 GURL session_only_origin("http://www.sessiononly.com"); | 30 GURL session_only_origin("http://www.sessiononly.com"); |
| 29 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy = | 31 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy = |
| 30 new quota::MockSpecialStoragePolicy; | 32 new quota::MockSpecialStoragePolicy; |
| 31 special_storage_policy->AddSessionOnly(session_only_origin); | 33 special_storage_policy->AddSessionOnly(session_only_origin); |
| 32 | 34 |
| 33 // A scope for deleting TestBrowserContext early enough. | 35 // A scope for deleting TestBrowserContext early enough. |
| 34 { | 36 { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 64 browser_context.GetWebKitContext()->DeleteSessionOnlyData(); | 66 browser_context.GetWebKitContext()->DeleteSessionOnlyData(); |
| 65 | 67 |
| 66 // Expected result: the database file for the permanent storage remains but | 68 // Expected result: the database file for the permanent storage remains but |
| 67 // the database for the session only storage was deleted. | 69 // the database for the session only storage was deleted. |
| 68 EXPECT_FALSE(file_util::PathExists(session_only_database_path)); | 70 EXPECT_FALSE(file_util::PathExists(session_only_database_path)); |
| 69 EXPECT_TRUE(file_util::PathExists(permanent_database_path)); | 71 EXPECT_TRUE(file_util::PathExists(permanent_database_path)); |
| 70 } | 72 } |
| 71 // Run the message loop to ensure that DOMStorageContext gets destroyed. | 73 // Run the message loop to ensure that DOMStorageContext gets destroyed. |
| 72 message_loop_.RunAllPending(); | 74 message_loop_.RunAllPending(); |
| 73 } | 75 } |
| OLD | NEW |