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

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

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