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

Side by Side Diff: content/browser/in_process_webkit/dom_storage_unittest.cc

Issue 8340028: Salient parts of http://codereview.chromium.org/8392042/ (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years, 1 month 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
OLDNEW
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/in_process_webkit/webkit_context.h" 7 #include "content/browser/in_process_webkit/webkit_context.h"
8 #include "content/test/test_browser_context.h" 8 #include "content/test/test_browser_context.h"
9 #include "content/test/test_browser_thread.h"
9 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
10 #include "webkit/quota/mock_special_storage_policy.h" 11 #include "webkit/quota/mock_special_storage_policy.h"
11 12
12 class DOMStorageTest : public testing::Test { 13 class DOMStorageTest : public testing::Test {
13 public: 14 public:
14 DOMStorageTest() 15 DOMStorageTest()
15 : message_loop_(MessageLoop::TYPE_IO), 16 : message_loop_(MessageLoop::TYPE_IO),
16 webkit_thread_(BrowserThread::WEBKIT, &message_loop_) { 17 webkit_thread_(BrowserThread::WEBKIT, &message_loop_) {
17 } 18 }
18 19
19 protected: 20 protected:
20 MessageLoop message_loop_; 21 MessageLoop message_loop_;
21 22
22 private: 23 private:
23 BrowserThread webkit_thread_; 24 content::TestBrowserThread webkit_thread_;
24 }; 25 };
25 26
26 TEST_F(DOMStorageTest, SessionOnly) { 27 TEST_F(DOMStorageTest, SessionOnly) {
27 GURL session_only_origin("http://www.sessiononly.com"); 28 GURL session_only_origin("http://www.sessiononly.com");
28 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy = 29 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy =
29 new quota::MockSpecialStoragePolicy; 30 new quota::MockSpecialStoragePolicy;
30 special_storage_policy->AddSessionOnly(session_only_origin); 31 special_storage_policy->AddSessionOnly(session_only_origin);
31 32
32 // A scope for deleting TestBrowserContext early enough. 33 // A scope for deleting TestBrowserContext early enough.
33 { 34 {
(...skipping 29 matching lines...) Expand all
63 browser_context.GetWebKitContext()->DeleteSessionOnlyData(); 64 browser_context.GetWebKitContext()->DeleteSessionOnlyData();
64 65
65 // Expected result: the database file for the permanent storage remains but 66 // Expected result: the database file for the permanent storage remains but
66 // the database for the session only storage was deleted. 67 // the database for the session only storage was deleted.
67 EXPECT_FALSE(file_util::PathExists(session_only_database_path)); 68 EXPECT_FALSE(file_util::PathExists(session_only_database_path));
68 EXPECT_TRUE(file_util::PathExists(permanent_database_path)); 69 EXPECT_TRUE(file_util::PathExists(permanent_database_path));
69 } 70 }
70 // Run the message loop to ensure that DOMStorageContext gets destroyed. 71 // Run the message loop to ensure that DOMStorageContext gets destroyed.
71 message_loop_.RunAllPending(); 72 message_loop_.RunAllPending();
72 } 73 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698