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

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

Issue 602883003: Replacing the OVERRIDE with override and FINAL with final in content/browser/indexed_db (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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 using storage::DatabaseUtil; 42 using storage::DatabaseUtil;
43 43
44 namespace content { 44 namespace content {
45 45
46 // This browser test is aimed towards exercising the IndexedDB bindings and 46 // This browser test is aimed towards exercising the IndexedDB bindings and
47 // the actual implementation that lives in the browser side. 47 // the actual implementation that lives in the browser side.
48 class IndexedDBBrowserTest : public ContentBrowserTest { 48 class IndexedDBBrowserTest : public ContentBrowserTest {
49 public: 49 public:
50 IndexedDBBrowserTest() : disk_usage_(-1) {} 50 IndexedDBBrowserTest() : disk_usage_(-1) {}
51 51
52 virtual void SetUp() OVERRIDE { 52 virtual void SetUp() override {
53 GetTestClassFactory()->Reset(); 53 GetTestClassFactory()->Reset();
54 IndexedDBClassFactory::SetIndexedDBClassFactoryGetter(GetIDBClassFactory); 54 IndexedDBClassFactory::SetIndexedDBClassFactoryGetter(GetIDBClassFactory);
55 ContentBrowserTest::SetUp(); 55 ContentBrowserTest::SetUp();
56 } 56 }
57 57
58 virtual void TearDown() OVERRIDE { 58 virtual void TearDown() override {
59 IndexedDBClassFactory::SetIndexedDBClassFactoryGetter(NULL); 59 IndexedDBClassFactory::SetIndexedDBClassFactoryGetter(NULL);
60 ContentBrowserTest::TearDown(); 60 ContentBrowserTest::TearDown();
61 } 61 }
62 62
63 void FailOperation(FailClass failure_class, 63 void FailOperation(FailClass failure_class,
64 FailMethod failure_method, 64 FailMethod failure_method,
65 int fail_on_instance_num, 65 int fail_on_instance_num,
66 int fail_on_call_num) { 66 int fail_on_call_num) {
67 GetTestClassFactory()->FailOperation( 67 GetTestClassFactory()->FailOperation(
68 failure_class, failure_method, fail_on_instance_num, fail_on_call_num); 68 failure_class, failure_method, fail_on_instance_num, fail_on_call_num);
(...skipping 170 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 virtual 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 virtual 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 virtual 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 virtual std::string EnclosingLevelDBDir() override {
321 return "migration_from_0"; 321 return "migration_from_0";
322 } 322 }
323 }; 323 };
324 324
325 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion0Schema, MigrationTest) { 325 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion0Schema, MigrationTest) {
326 SimpleTest(GetTestUrl("indexeddb", "migration_test.html")); 326 SimpleTest(GetTestUrl("indexeddb", "migration_test.html"));
327 } 327 }
328 328
329 class IndexedDBBrowserTestWithVersion123456Schema : public 329 class IndexedDBBrowserTestWithVersion123456Schema : public
330 IndexedDBBrowserTestWithPreexistingLevelDB { 330 IndexedDBBrowserTestWithPreexistingLevelDB {
331 virtual std::string EnclosingLevelDBDir() OVERRIDE { 331 virtual std::string EnclosingLevelDBDir() override {
332 return "schema_version_123456"; 332 return "schema_version_123456";
333 } 333 }
334 }; 334 };
335 335
336 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion123456Schema, 336 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion123456Schema,
337 DestroyTest) { 337 DestroyTest) {
338 int64 original_size = RequestDiskUsage(); 338 int64 original_size = RequestDiskUsage();
339 EXPECT_GT(original_size, 0); 339 EXPECT_GT(original_size, 0);
340 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html")); 340 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html"));
341 int64 new_size = RequestDiskUsage(); 341 int64 new_size = RequestDiskUsage();
342 EXPECT_NE(original_size, new_size); 342 EXPECT_NE(original_size, new_size);
343 } 343 }
344 344
345 class IndexedDBBrowserTestWithVersion987654SSVData : public 345 class IndexedDBBrowserTestWithVersion987654SSVData : public
346 IndexedDBBrowserTestWithPreexistingLevelDB { 346 IndexedDBBrowserTestWithPreexistingLevelDB {
347 virtual std::string EnclosingLevelDBDir() OVERRIDE { 347 virtual std::string EnclosingLevelDBDir() override {
348 return "ssv_version_987654"; 348 return "ssv_version_987654";
349 } 349 }
350 }; 350 };
351 351
352 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion987654SSVData, 352 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion987654SSVData,
353 DestroyTest) { 353 DestroyTest) {
354 int64 original_size = RequestDiskUsage(); 354 int64 original_size = RequestDiskUsage();
355 EXPECT_GT(original_size, 0); 355 EXPECT_GT(original_size, 0);
356 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html")); 356 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html"));
357 int64 new_size = RequestDiskUsage(); 357 int64 new_size = RequestDiskUsage();
358 EXPECT_NE(original_size, new_size); 358 EXPECT_NE(original_size, new_size);
359 } 359 }
360 360
361 class IndexedDBBrowserTestWithCorruptLevelDB : public 361 class IndexedDBBrowserTestWithCorruptLevelDB : public
362 IndexedDBBrowserTestWithPreexistingLevelDB { 362 IndexedDBBrowserTestWithPreexistingLevelDB {
363 virtual std::string EnclosingLevelDBDir() OVERRIDE { 363 virtual std::string EnclosingLevelDBDir() override {
364 return "corrupt_leveldb"; 364 return "corrupt_leveldb";
365 } 365 }
366 }; 366 };
367 367
368 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithCorruptLevelDB, 368 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithCorruptLevelDB,
369 DestroyTest) { 369 DestroyTest) {
370 int64 original_size = RequestDiskUsage(); 370 int64 original_size = RequestDiskUsage();
371 EXPECT_GT(original_size, 0); 371 EXPECT_GT(original_size, 0);
372 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html")); 372 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html"));
373 int64 new_size = RequestDiskUsage(); 373 int64 new_size = RequestDiskUsage();
374 EXPECT_NE(original_size, new_size); 374 EXPECT_NE(original_size, new_size);
375 } 375 }
376 376
377 class IndexedDBBrowserTestWithMissingSSTFile : public 377 class IndexedDBBrowserTestWithMissingSSTFile : public
378 IndexedDBBrowserTestWithPreexistingLevelDB { 378 IndexedDBBrowserTestWithPreexistingLevelDB {
379 virtual std::string EnclosingLevelDBDir() OVERRIDE { 379 virtual std::string EnclosingLevelDBDir() override {
380 return "missing_sst"; 380 return "missing_sst";
381 } 381 }
382 }; 382 };
383 383
384 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithMissingSSTFile, 384 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithMissingSSTFile,
385 DestroyTest) { 385 DestroyTest) {
386 int64 original_size = RequestDiskUsage(); 386 int64 original_size = RequestDiskUsage();
387 EXPECT_GT(original_size, 0); 387 EXPECT_GT(original_size, 0);
388 SimpleTest(GetTestUrl("indexeddb", "open_missing_table.html")); 388 SimpleTest(GetTestUrl("indexeddb", "open_missing_table.html"));
389 int64 new_size = RequestDiskUsage(); 389 int64 new_size = RequestDiskUsage();
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 GURL("file:///"))); 716 GURL("file:///")));
717 717
718 base::string16 expected_title16(ASCIIToUTF16("connection closed")); 718 base::string16 expected_title16(ASCIIToUTF16("connection closed"));
719 TitleWatcher title_watcher(shell()->web_contents(), expected_title16); 719 TitleWatcher title_watcher(shell()->web_contents(), expected_title16);
720 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("connection closed with error")); 720 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("connection closed with error"));
721 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); 721 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle());
722 } 722 }
723 723
724 class IndexedDBBrowserTestSingleProcess : public IndexedDBBrowserTest { 724 class IndexedDBBrowserTestSingleProcess : public IndexedDBBrowserTest {
725 public: 725 public:
726 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 726 virtual void SetUpCommandLine(CommandLine* command_line) override {
727 command_line->AppendSwitch(switches::kSingleProcess); 727 command_line->AppendSwitch(switches::kSingleProcess);
728 } 728 }
729 }; 729 };
730 730
731 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestSingleProcess, 731 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestSingleProcess,
732 RenderThreadShutdownTest) { 732 RenderThreadShutdownTest) {
733 SimpleTest(GetTestUrl("indexeddb", "shutdown_with_requests.html")); 733 SimpleTest(GetTestUrl("indexeddb", "shutdown_with_requests.html"));
734 } 734 }
735 735
736 } // namespace content 736 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698