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

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

Issue 9695013: DOMStorageContextImpl that's implemented in terms of the new dom_storage classes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 months 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) 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/browser_thread_impl.h"
8 #include "content/browser/in_process_webkit/dom_storage_context_impl.h" 8 #include "content/browser/in_process_webkit/dom_storage_context_impl.h"
9 #include "content/test/test_browser_context.h" 9 #include "content/test/test_browser_context.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "webkit/dom_storage/dom_storage_types.h"
11 #include "webkit/quota/mock_special_storage_policy.h" 12 #include "webkit/quota/mock_special_storage_policy.h"
12 13
14 #ifdef ENABLE_NEW_DOM_STORAGE_BACKEND
15 // No longer applicable.
16 #else
17
13 using content::BrowserContext; 18 using content::BrowserContext;
14 using content::BrowserThread; 19 using content::BrowserThread;
15 using content::BrowserThreadImpl; 20 using content::BrowserThreadImpl;
16 21
17 class DOMStorageTest : public testing::Test { 22 class DOMStorageTest : public testing::Test {
18 public: 23 public:
19 DOMStorageTest() 24 DOMStorageTest()
20 : message_loop_(MessageLoop::TYPE_IO), 25 : message_loop_(MessageLoop::TYPE_IO),
21 webkit_thread_(BrowserThread::WEBKIT_DEPRECATED, &message_loop_) { 26 webkit_thread_(BrowserThread::WEBKIT_DEPRECATED, &message_loop_) {
22 } 27 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 106
102 ASSERT_EQ(1, file_util::WriteFile(session_only_database_path, ".", 1)); 107 ASSERT_EQ(1, file_util::WriteFile(session_only_database_path, ".", 1));
103 ASSERT_EQ(1, file_util::WriteFile(permanent_database_path, ".", 1)); 108 ASSERT_EQ(1, file_util::WriteFile(permanent_database_path, ".", 1));
104 109
105 // Inject MockSpecialStoragePolicy into DOMStorageContext. 110 // Inject MockSpecialStoragePolicy into DOMStorageContext.
106 DOMStorageContextImpl* dom_storage_context = 111 DOMStorageContextImpl* dom_storage_context =
107 static_cast<DOMStorageContextImpl*>( 112 static_cast<DOMStorageContextImpl*>(
108 BrowserContext::GetDOMStorageContext(browser_context.get())); 113 BrowserContext::GetDOMStorageContext(browser_context.get()));
109 dom_storage_context->special_storage_policy_ = special_storage_policy; 114 dom_storage_context->special_storage_policy_ = special_storage_policy;
110 115
111 dom_storage_context->set_clear_local_state_on_exit(true); 116 dom_storage_context->SetClearLocalState(true);
112 117
113 // Save session state. This should bypass the destruction-time deletion. 118 // Save session state. This should bypass the destruction-time deletion.
114 dom_storage_context->SaveSessionState(); 119 dom_storage_context->SaveSessionState();
115 120
116 // Delete the TestBrowserContext but own the temp dir. This way the 121 // Delete the TestBrowserContext but own the temp dir. This way the
117 // temporary data directory stays alive long enough to conduct the test. 122 // temporary data directory stays alive long enough to conduct the test.
118 ScopedTempDir temp_dir; 123 ScopedTempDir temp_dir;
119 ignore_result(temp_dir.Set(browser_context->TakePath())); 124 ignore_result(temp_dir.Set(browser_context->TakePath()));
120 browser_context.reset(); 125 browser_context.reset();
121 // Run the message loop to ensure that DOMStorageContext gets destroyed. 126 // Run the message loop to ensure that DOMStorageContext gets destroyed.
122 message_loop_.RunAllPending(); 127 message_loop_.RunAllPending();
123 128
124 // Expected result: no database files were deleted because of 129 // Expected result: no database files were deleted because of
125 // SaveSessionState. 130 // SaveSessionState.
126 EXPECT_TRUE(file_util::PathExists(session_only_database_path)); 131 EXPECT_TRUE(file_util::PathExists(session_only_database_path));
127 EXPECT_TRUE(file_util::PathExists(permanent_database_path)); 132 EXPECT_TRUE(file_util::PathExists(permanent_database_path));
128 } 133 }
134
135 #endif // ENABLE_NEW_DOM_STORAGE_BACKEND
OLDNEW
« no previous file with comments | « content/browser/in_process_webkit/dom_storage_uitest.cc ('k') | content/browser/renderer_host/render_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698