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

Side by Side Diff: content/browser/indexed_db/indexed_db_browsertest.cc

Issue 667943003: Standardize usage of virtual/override/final in content/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/files/file.h" 7 #include "base/files/file.h"
8 #include "base/files/file_enumerator.h" 8 #include "base/files/file_enumerator.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 const GURL url = GetTestUrl("indexeddb", "bug_109187.html"); 239 const GURL url = GetTestUrl("indexeddb", "bug_109187.html");
240 240
241 // Just navigate to the URL. Test will crash if it fails. 241 // Just navigate to the URL. Test will crash if it fails.
242 NavigateToURLBlockUntilNavigationsComplete(shell(), url, 1); 242 NavigateToURLBlockUntilNavigationsComplete(shell(), url, 1);
243 } 243 }
244 244
245 class IndexedDBBrowserTestWithLowQuota : public IndexedDBBrowserTest { 245 class IndexedDBBrowserTestWithLowQuota : public IndexedDBBrowserTest {
246 public: 246 public:
247 IndexedDBBrowserTestWithLowQuota() {} 247 IndexedDBBrowserTestWithLowQuota() {}
248 248
249 virtual void SetUpOnMainThread() override { 249 void SetUpOnMainThread() override {
250 const int kInitialQuotaKilobytes = 5000; 250 const int kInitialQuotaKilobytes = 5000;
251 SetQuota(kInitialQuotaKilobytes); 251 SetQuota(kInitialQuotaKilobytes);
252 } 252 }
253 253
254 private: 254 private:
255 DISALLOW_COPY_AND_ASSIGN(IndexedDBBrowserTestWithLowQuota); 255 DISALLOW_COPY_AND_ASSIGN(IndexedDBBrowserTestWithLowQuota);
256 }; 256 };
257 257
258 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithLowQuota, QuotaTest) { 258 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithLowQuota, QuotaTest) {
259 SimpleTest(GetTestUrl("indexeddb", "quota_test.html")); 259 SimpleTest(GetTestUrl("indexeddb", "quota_test.html"));
260 } 260 }
261 261
262 class IndexedDBBrowserTestWithGCExposed : public IndexedDBBrowserTest { 262 class IndexedDBBrowserTestWithGCExposed : public IndexedDBBrowserTest {
263 public: 263 public:
264 IndexedDBBrowserTestWithGCExposed() {} 264 IndexedDBBrowserTestWithGCExposed() {}
265 265
266 virtual void SetUpCommandLine(CommandLine* command_line) override { 266 void SetUpCommandLine(CommandLine* command_line) override {
267 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); 267 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc");
268 } 268 }
269 269
270 private: 270 private:
271 DISALLOW_COPY_AND_ASSIGN(IndexedDBBrowserTestWithGCExposed); 271 DISALLOW_COPY_AND_ASSIGN(IndexedDBBrowserTestWithGCExposed);
272 }; 272 };
273 273
274 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithGCExposed, 274 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithGCExposed,
275 DatabaseCallbacksTest) { 275 DatabaseCallbacksTest) {
276 SimpleTest(GetTestUrl("indexeddb", "database_callbacks_first.html")); 276 SimpleTest(GetTestUrl("indexeddb", "database_callbacks_first.html"));
(...skipping 13 matching lines...) Expand all
290 ASSERT_TRUE(base::CreateDirectory(dest)); 290 ASSERT_TRUE(base::CreateDirectory(dest));
291 const bool kRecursive = true; 291 const bool kRecursive = true;
292 ASSERT_TRUE(base::CopyDirectory(test_data_dir, 292 ASSERT_TRUE(base::CopyDirectory(test_data_dir,
293 context->data_path(), 293 context->data_path(),
294 kRecursive)); 294 kRecursive));
295 } 295 }
296 296
297 class IndexedDBBrowserTestWithPreexistingLevelDB : public IndexedDBBrowserTest { 297 class IndexedDBBrowserTestWithPreexistingLevelDB : public IndexedDBBrowserTest {
298 public: 298 public:
299 IndexedDBBrowserTestWithPreexistingLevelDB() {} 299 IndexedDBBrowserTestWithPreexistingLevelDB() {}
300 virtual void SetUpOnMainThread() override { 300 void SetUpOnMainThread() override {
301 scoped_refptr<IndexedDBContextImpl> context = GetContext(); 301 scoped_refptr<IndexedDBContextImpl> context = GetContext();
302 context->TaskRunner()->PostTask( 302 context->TaskRunner()->PostTask(
303 FROM_HERE, 303 FROM_HERE,
304 base::Bind( 304 base::Bind(
305 &CopyLevelDBToProfile, shell(), context, EnclosingLevelDBDir())); 305 &CopyLevelDBToProfile, shell(), context, EnclosingLevelDBDir()));
306 scoped_refptr<base::ThreadTestHelper> helper(new base::ThreadTestHelper( 306 scoped_refptr<base::ThreadTestHelper> helper(new base::ThreadTestHelper(
307 BrowserMainLoop::GetInstance()->indexed_db_thread()-> 307 BrowserMainLoop::GetInstance()->indexed_db_thread()->
308 message_loop_proxy())); 308 message_loop_proxy()));
309 ASSERT_TRUE(helper->Run()); 309 ASSERT_TRUE(helper->Run());
310 } 310 }
311 311
312 virtual std::string EnclosingLevelDBDir() = 0; 312 virtual std::string EnclosingLevelDBDir() = 0;
313 313
314 private: 314 private:
315 DISALLOW_COPY_AND_ASSIGN(IndexedDBBrowserTestWithPreexistingLevelDB); 315 DISALLOW_COPY_AND_ASSIGN(IndexedDBBrowserTestWithPreexistingLevelDB);
316 }; 316 };
317 317
318 class IndexedDBBrowserTestWithVersion0Schema : public 318 class IndexedDBBrowserTestWithVersion0Schema : public
319 IndexedDBBrowserTestWithPreexistingLevelDB { 319 IndexedDBBrowserTestWithPreexistingLevelDB {
320 virtual std::string EnclosingLevelDBDir() override { 320 std::string EnclosingLevelDBDir() override { return "migration_from_0"; }
321 return "migration_from_0";
322 }
323 }; 321 };
324 322
325 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion0Schema, MigrationTest) { 323 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion0Schema, MigrationTest) {
326 SimpleTest(GetTestUrl("indexeddb", "migration_test.html")); 324 SimpleTest(GetTestUrl("indexeddb", "migration_test.html"));
327 } 325 }
328 326
329 class IndexedDBBrowserTestWithVersion123456Schema : public 327 class IndexedDBBrowserTestWithVersion123456Schema : public
330 IndexedDBBrowserTestWithPreexistingLevelDB { 328 IndexedDBBrowserTestWithPreexistingLevelDB {
331 virtual std::string EnclosingLevelDBDir() override { 329 std::string EnclosingLevelDBDir() override { return "schema_version_123456"; }
332 return "schema_version_123456";
333 }
334 }; 330 };
335 331
336 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion123456Schema, 332 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion123456Schema,
337 DestroyTest) { 333 DestroyTest) {
338 int64 original_size = RequestDiskUsage(); 334 int64 original_size = RequestDiskUsage();
339 EXPECT_GT(original_size, 0); 335 EXPECT_GT(original_size, 0);
340 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html")); 336 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html"));
341 int64 new_size = RequestDiskUsage(); 337 int64 new_size = RequestDiskUsage();
342 EXPECT_NE(original_size, new_size); 338 EXPECT_NE(original_size, new_size);
343 } 339 }
344 340
345 class IndexedDBBrowserTestWithVersion987654SSVData : public 341 class IndexedDBBrowserTestWithVersion987654SSVData : public
346 IndexedDBBrowserTestWithPreexistingLevelDB { 342 IndexedDBBrowserTestWithPreexistingLevelDB {
347 virtual std::string EnclosingLevelDBDir() override { 343 std::string EnclosingLevelDBDir() override { return "ssv_version_987654"; }
348 return "ssv_version_987654";
349 }
350 }; 344 };
351 345
352 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion987654SSVData, 346 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion987654SSVData,
353 DestroyTest) { 347 DestroyTest) {
354 int64 original_size = RequestDiskUsage(); 348 int64 original_size = RequestDiskUsage();
355 EXPECT_GT(original_size, 0); 349 EXPECT_GT(original_size, 0);
356 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html")); 350 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html"));
357 int64 new_size = RequestDiskUsage(); 351 int64 new_size = RequestDiskUsage();
358 EXPECT_NE(original_size, new_size); 352 EXPECT_NE(original_size, new_size);
359 } 353 }
360 354
361 class IndexedDBBrowserTestWithCorruptLevelDB : public 355 class IndexedDBBrowserTestWithCorruptLevelDB : public
362 IndexedDBBrowserTestWithPreexistingLevelDB { 356 IndexedDBBrowserTestWithPreexistingLevelDB {
363 virtual std::string EnclosingLevelDBDir() override { 357 std::string EnclosingLevelDBDir() override { return "corrupt_leveldb"; }
364 return "corrupt_leveldb";
365 }
366 }; 358 };
367 359
368 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithCorruptLevelDB, 360 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithCorruptLevelDB,
369 DestroyTest) { 361 DestroyTest) {
370 int64 original_size = RequestDiskUsage(); 362 int64 original_size = RequestDiskUsage();
371 EXPECT_GT(original_size, 0); 363 EXPECT_GT(original_size, 0);
372 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html")); 364 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html"));
373 int64 new_size = RequestDiskUsage(); 365 int64 new_size = RequestDiskUsage();
374 EXPECT_NE(original_size, new_size); 366 EXPECT_NE(original_size, new_size);
375 } 367 }
376 368
377 class IndexedDBBrowserTestWithMissingSSTFile : public 369 class IndexedDBBrowserTestWithMissingSSTFile : public
378 IndexedDBBrowserTestWithPreexistingLevelDB { 370 IndexedDBBrowserTestWithPreexistingLevelDB {
379 virtual std::string EnclosingLevelDBDir() override { 371 std::string EnclosingLevelDBDir() override { return "missing_sst"; }
380 return "missing_sst";
381 }
382 }; 372 };
383 373
384 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithMissingSSTFile, 374 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithMissingSSTFile,
385 DestroyTest) { 375 DestroyTest) {
386 int64 original_size = RequestDiskUsage(); 376 int64 original_size = RequestDiskUsage();
387 EXPECT_GT(original_size, 0); 377 EXPECT_GT(original_size, 0);
388 SimpleTest(GetTestUrl("indexeddb", "open_missing_table.html")); 378 SimpleTest(GetTestUrl("indexeddb", "open_missing_table.html"));
389 int64 new_size = RequestDiskUsage(); 379 int64 new_size = RequestDiskUsage();
390 EXPECT_NE(original_size, new_size); 380 EXPECT_NE(original_size, new_size);
391 } 381 }
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 GURL("file:///"))); 706 GURL("file:///")));
717 707
718 base::string16 expected_title16(ASCIIToUTF16("connection closed")); 708 base::string16 expected_title16(ASCIIToUTF16("connection closed"));
719 TitleWatcher title_watcher(shell()->web_contents(), expected_title16); 709 TitleWatcher title_watcher(shell()->web_contents(), expected_title16);
720 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("connection closed with error")); 710 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("connection closed with error"));
721 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); 711 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle());
722 } 712 }
723 713
724 class IndexedDBBrowserTestSingleProcess : public IndexedDBBrowserTest { 714 class IndexedDBBrowserTestSingleProcess : public IndexedDBBrowserTest {
725 public: 715 public:
726 virtual void SetUpCommandLine(CommandLine* command_line) override { 716 void SetUpCommandLine(CommandLine* command_line) override {
727 command_line->AppendSwitch(switches::kSingleProcess); 717 command_line->AppendSwitch(switches::kSingleProcess);
728 } 718 }
729 }; 719 };
730 720
731 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestSingleProcess, 721 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestSingleProcess,
732 RenderThreadShutdownTest) { 722 RenderThreadShutdownTest) {
733 SimpleTest(GetTestUrl("indexeddb", "shutdown_with_requests.html")); 723 SimpleTest(GetTestUrl("indexeddb", "shutdown_with_requests.html"));
734 } 724 }
735 725
736 } // namespace content 726 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698