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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 ASSERT_TRUE(file_util::CreateDirectory(protected_path)); | 164 ASSERT_TRUE(file_util::CreateDirectory(protected_path)); |
165 ASSERT_TRUE(file_util::CreateDirectory(unprotected_path)); | 165 ASSERT_TRUE(file_util::CreateDirectory(unprotected_path)); |
166 | 166 |
167 // Setup to clear all unprotected origins on exit. | 167 // Setup to clear all unprotected origins on exit. |
168 webkit_context->set_clear_local_state_on_exit(true); | 168 webkit_context->set_clear_local_state_on_exit(true); |
169 } | 169 } |
170 | 170 |
171 // Make sure we wait until the destructor has run. | 171 // Make sure we wait until the destructor has run. |
172 scoped_refptr<base::ThreadTestHelper> helper( | 172 scoped_refptr<base::ThreadTestHelper> helper( |
173 new base::ThreadTestHelper( | 173 new base::ThreadTestHelper( |
174 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::WEBKIT))); | 174 BrowserThread::GetMessageLoopProxyForThread( |
| 175 BrowserThread::WEBKIT_DEPRECATED))); |
175 ASSERT_TRUE(helper->Run()); | 176 ASSERT_TRUE(helper->Run()); |
176 | 177 |
177 ASSERT_TRUE(file_util::DirectoryExists(protected_path)); | 178 ASSERT_TRUE(file_util::DirectoryExists(protected_path)); |
178 ASSERT_FALSE(file_util::DirectoryExists(unprotected_path)); | 179 ASSERT_FALSE(file_util::DirectoryExists(unprotected_path)); |
179 } | 180 } |
180 | 181 |
181 // In proc browser test is needed here because ClearLocalState indirectly calls | 182 // In proc browser test is needed here because ClearLocalState indirectly calls |
182 // WebKit's isMainThread through WebSecurityOrigin->SecurityOrigin. | 183 // WebKit's isMainThread through WebSecurityOrigin->SecurityOrigin. |
183 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, ClearSessionOnlyDatabases) { | 184 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, ClearSessionOnlyDatabases) { |
184 ScopedTempDir temp_dir; | 185 ScopedTempDir temp_dir; |
(...skipping 26 matching lines...) Expand all Loading... |
211 DatabaseUtil::GetOriginIdentifier(kNormalOrigin)); | 212 DatabaseUtil::GetOriginIdentifier(kNormalOrigin)); |
212 session_only_path = idb_context->GetIndexedDBFilePath( | 213 session_only_path = idb_context->GetIndexedDBFilePath( |
213 DatabaseUtil::GetOriginIdentifier(kSessionOnlyOrigin)); | 214 DatabaseUtil::GetOriginIdentifier(kSessionOnlyOrigin)); |
214 ASSERT_TRUE(file_util::CreateDirectory(normal_path)); | 215 ASSERT_TRUE(file_util::CreateDirectory(normal_path)); |
215 ASSERT_TRUE(file_util::CreateDirectory(session_only_path)); | 216 ASSERT_TRUE(file_util::CreateDirectory(session_only_path)); |
216 } | 217 } |
217 | 218 |
218 // Make sure we wait until the destructor has run. | 219 // Make sure we wait until the destructor has run. |
219 scoped_refptr<base::ThreadTestHelper> helper( | 220 scoped_refptr<base::ThreadTestHelper> helper( |
220 new base::ThreadTestHelper( | 221 new base::ThreadTestHelper( |
221 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::WEBKIT))); | 222 BrowserThread::GetMessageLoopProxyForThread( |
| 223 BrowserThread::WEBKIT_DEPRECATED))); |
222 ASSERT_TRUE(helper->Run()); | 224 ASSERT_TRUE(helper->Run()); |
223 | 225 |
224 EXPECT_TRUE(file_util::DirectoryExists(normal_path)); | 226 EXPECT_TRUE(file_util::DirectoryExists(normal_path)); |
225 EXPECT_FALSE(file_util::DirectoryExists(session_only_path)); | 227 EXPECT_FALSE(file_util::DirectoryExists(session_only_path)); |
226 } | 228 } |
227 | 229 |
228 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, SaveSessionState) { | 230 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, SaveSessionState) { |
229 ScopedTempDir temp_dir; | 231 ScopedTempDir temp_dir; |
230 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 232 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
231 | 233 |
(...skipping 28 matching lines...) Expand all Loading... |
260 DatabaseUtil::GetOriginIdentifier(kNormalOrigin)); | 262 DatabaseUtil::GetOriginIdentifier(kNormalOrigin)); |
261 session_only_path = idb_context->GetIndexedDBFilePath( | 263 session_only_path = idb_context->GetIndexedDBFilePath( |
262 DatabaseUtil::GetOriginIdentifier(kSessionOnlyOrigin)); | 264 DatabaseUtil::GetOriginIdentifier(kSessionOnlyOrigin)); |
263 ASSERT_TRUE(file_util::CreateDirectory(normal_path)); | 265 ASSERT_TRUE(file_util::CreateDirectory(normal_path)); |
264 ASSERT_TRUE(file_util::CreateDirectory(session_only_path)); | 266 ASSERT_TRUE(file_util::CreateDirectory(session_only_path)); |
265 } | 267 } |
266 | 268 |
267 // Make sure we wait until the destructor has run. | 269 // Make sure we wait until the destructor has run. |
268 scoped_refptr<base::ThreadTestHelper> helper( | 270 scoped_refptr<base::ThreadTestHelper> helper( |
269 new base::ThreadTestHelper( | 271 new base::ThreadTestHelper( |
270 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::WEBKIT))); | 272 BrowserThread::GetMessageLoopProxyForThread( |
| 273 BrowserThread::WEBKIT_DEPRECATED))); |
271 ASSERT_TRUE(helper->Run()); | 274 ASSERT_TRUE(helper->Run()); |
272 | 275 |
273 // No data was cleared because of SaveSessionState. | 276 // No data was cleared because of SaveSessionState. |
274 EXPECT_TRUE(file_util::DirectoryExists(normal_path)); | 277 EXPECT_TRUE(file_util::DirectoryExists(normal_path)); |
275 EXPECT_TRUE(file_util::DirectoryExists(session_only_path)); | 278 EXPECT_TRUE(file_util::DirectoryExists(session_only_path)); |
276 } | 279 } |
277 | 280 |
278 class IndexedDBBrowserTestWithLowQuota : public IndexedDBBrowserTest { | 281 class IndexedDBBrowserTestWithLowQuota : public IndexedDBBrowserTest { |
279 public: | 282 public: |
280 virtual void SetUpOnMainThread() { | 283 virtual void SetUpOnMainThread() { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 virtual void SetUpCommandLine(CommandLine* command_line) { | 316 virtual void SetUpCommandLine(CommandLine* command_line) { |
314 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); | 317 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); |
315 } | 318 } |
316 }; | 319 }; |
317 | 320 |
318 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithGCExposed, | 321 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithGCExposed, |
319 DatabaseCallbacksTest) { | 322 DatabaseCallbacksTest) { |
320 SimpleTest( | 323 SimpleTest( |
321 testUrl(FilePath(FILE_PATH_LITERAL("database_callbacks_first.html")))); | 324 testUrl(FilePath(FILE_PATH_LITERAL("database_callbacks_first.html")))); |
322 } | 325 } |
OLD | NEW |