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

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

Issue 11359217: Move scoped_temp_dir from base to base/files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
OLDNEW
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/file_util.h" 5 #include "base/file_util.h"
6 #include "base/scoped_temp_dir.h" 6 #include "base/files/scoped_temp_dir.h"
7 #include "content/browser/browser_thread_impl.h" 7 #include "content/browser/browser_thread_impl.h"
8 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" 8 #include "content/browser/in_process_webkit/indexed_db_context_impl.h"
9 #include "content/public/browser/storage_partition.h" 9 #include "content/public/browser/storage_partition.h"
10 #include "content/public/common/url_constants.h" 10 #include "content/public/common/url_constants.h"
11 #include "content/public/test/test_browser_context.h" 11 #include "content/public/test/test_browser_context.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h"
14 #include "webkit/database/database_util.h" 14 #include "webkit/database/database_util.h"
15 #include "webkit/quota/mock_special_storage_policy.h" 15 #include "webkit/quota/mock_special_storage_policy.h"
16 #include "webkit/quota/quota_manager.h" 16 #include "webkit/quota/quota_manager.h"
(...skipping 15 matching lines...) Expand all
32 protected: 32 protected:
33 MessageLoop message_loop_; 33 MessageLoop message_loop_;
34 34
35 private: 35 private:
36 BrowserThreadImpl webkit_thread_; 36 BrowserThreadImpl webkit_thread_;
37 BrowserThreadImpl file_thread_; 37 BrowserThreadImpl file_thread_;
38 BrowserThreadImpl io_thread_; 38 BrowserThreadImpl io_thread_;
39 }; 39 };
40 40
41 TEST_F(IndexedDBTest, ClearSessionOnlyDatabases) { 41 TEST_F(IndexedDBTest, ClearSessionOnlyDatabases) {
42 ScopedTempDir temp_dir; 42 base::ScopedTempDir temp_dir;
43 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 43 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
44 44
45 FilePath normal_path; 45 FilePath normal_path;
46 FilePath session_only_path; 46 FilePath session_only_path;
47 47
48 // Create the scope which will ensure we run the destructor of the webkit 48 // Create the scope which will ensure we run the destructor of the webkit
49 // context which should trigger the clean up. 49 // context which should trigger the clean up.
50 { 50 {
51 TestBrowserContext browser_context; 51 TestBrowserContext browser_context;
52 52
(...skipping 23 matching lines...) Expand all
76 message_loop_.RunUntilIdle(); 76 message_loop_.RunUntilIdle();
77 } 77 }
78 78
79 message_loop_.RunUntilIdle(); 79 message_loop_.RunUntilIdle();
80 80
81 EXPECT_TRUE(file_util::DirectoryExists(normal_path)); 81 EXPECT_TRUE(file_util::DirectoryExists(normal_path));
82 EXPECT_FALSE(file_util::DirectoryExists(session_only_path)); 82 EXPECT_FALSE(file_util::DirectoryExists(session_only_path));
83 } 83 }
84 84
85 TEST_F(IndexedDBTest, SetForceKeepSessionState) { 85 TEST_F(IndexedDBTest, SetForceKeepSessionState) {
86 ScopedTempDir temp_dir; 86 base::ScopedTempDir temp_dir;
87 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 87 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
88 88
89 FilePath normal_path; 89 FilePath normal_path;
90 FilePath session_only_path; 90 FilePath session_only_path;
91 91
92 // Create the scope which will ensure we run the destructor of the webkit 92 // Create the scope which will ensure we run the destructor of the webkit
93 // context. 93 // context.
94 { 94 {
95 TestBrowserContext browser_context; 95 TestBrowserContext browser_context;
96 96
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 force_close_called_ = true; 149 force_close_called_ = true;
150 } 150 }
151 151
152 private: 152 private:
153 bool expect_force_close_; 153 bool expect_force_close_;
154 bool force_close_called_; 154 bool force_close_called_;
155 }; 155 };
156 156
157 157
158 TEST_F(IndexedDBTest, ForceCloseOpenDatabasesOnDelete) { 158 TEST_F(IndexedDBTest, ForceCloseOpenDatabasesOnDelete) {
159 ScopedTempDir temp_dir; 159 base::ScopedTempDir temp_dir;
160 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 160 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
161 161
162 FilePath test_path; 162 FilePath test_path;
163 163
164 // Create the scope which will ensure we run the destructor of the webkit 164 // Create the scope which will ensure we run the destructor of the webkit
165 // context. 165 // context.
166 { 166 {
167 TestBrowserContext browser_context; 167 TestBrowserContext browser_context;
168 168
169 const GURL kTestOrigin("http://test/"); 169 const GURL kTestOrigin("http://test/");
(...skipping 24 matching lines...) Expand all
194 message_loop_.RunUntilIdle(); 194 message_loop_.RunUntilIdle();
195 } 195 }
196 196
197 // Make sure we wait until the destructor has run. 197 // Make sure we wait until the destructor has run.
198 message_loop_.RunUntilIdle(); 198 message_loop_.RunUntilIdle();
199 199
200 EXPECT_FALSE(file_util::DirectoryExists(test_path)); 200 EXPECT_FALSE(file_util::DirectoryExists(test_path));
201 } 201 }
202 202
203 } // namespace content 203 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698