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

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

Issue 237143006: Make iterating over a corrupted IndexedDB fail. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added Status checks. Created 6 years, 8 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/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file.h" 8 #include "base/files/file.h"
9 #include "base/files/file_enumerator.h" 9 #include "base/files/file_enumerator.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 http_response->set_code(net::HTTP_OK); 466 http_response->set_code(net::HTTP_OK);
467 std::string file_contents; 467 std::string file_contents;
468 if (!base::ReadFileToString(resourcePath, &file_contents)) 468 if (!base::ReadFileToString(resourcePath, &file_contents))
469 return scoped_ptr<net::test_server::HttpResponse>(); 469 return scoped_ptr<net::test_server::HttpResponse>();
470 http_response->set_content(file_contents); 470 http_response->set_content(file_contents);
471 return http_response.PassAs<net::test_server::HttpResponse>(); 471 return http_response.PassAs<net::test_server::HttpResponse>();
472 } 472 }
473 473
474 } // namespace 474 } // namespace
475 475
476 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CorruptedOpenDatabase) { 476 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CorruptedOpenDatabaseGet) {
477 ASSERT_TRUE(embedded_test_server()->Started() || 477 ASSERT_TRUE(embedded_test_server()->Started() ||
478 embedded_test_server()->InitializeAndWaitUntilReady()); 478 embedded_test_server()->InitializeAndWaitUntilReady());
479 const GURL& origin_url = embedded_test_server()->base_url(); 479 const GURL& origin_url = embedded_test_server()->base_url();
480 embedded_test_server()->RegisterRequestHandler( 480 embedded_test_server()->RegisterRequestHandler(
481 base::Bind(&CorruptDBRequestHandler, 481 base::Bind(&CorruptDBRequestHandler,
482 base::ConstRef(GetContext()), 482 base::ConstRef(GetContext()),
483 origin_url, 483 origin_url,
484 s_corrupt_db_test_prefix)); 484 s_corrupt_db_test_prefix));
485 485
486 std::string test_file = 486 std::string test_file =
487 s_corrupt_db_test_prefix + "corrupted_open_db_detection.html"; 487 s_corrupt_db_test_prefix + "corrupted_open_db_detection.html#get";
488 SimpleTest(embedded_test_server()->GetURL(test_file)); 488 SimpleTest(embedded_test_server()->GetURL(test_file));
489 489
490 test_file = s_corrupt_db_test_prefix + "corrupted_open_db_recovery.html"; 490 test_file = s_corrupt_db_test_prefix + "corrupted_open_db_recovery.html";
491 SimpleTest(embedded_test_server()->GetURL(test_file));
492 }
493
494 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CorruptedOpenDatabaseIterate) {
495 ASSERT_TRUE(embedded_test_server()->Started() ||
496 embedded_test_server()->InitializeAndWaitUntilReady());
497 const GURL& origin_url = embedded_test_server()->base_url();
498 embedded_test_server()->RegisterRequestHandler(
499 base::Bind(&CorruptDBRequestHandler,
500 base::ConstRef(GetContext()),
501 origin_url,
502 s_corrupt_db_test_prefix));
503
504 std::string test_file =
505 s_corrupt_db_test_prefix + "corrupted_open_db_detection.html#iterate";
506 SimpleTest(embedded_test_server()->GetURL(test_file));
507
508 test_file = s_corrupt_db_test_prefix + "corrupted_open_db_recovery.html";
491 SimpleTest(embedded_test_server()->GetURL(test_file)); 509 SimpleTest(embedded_test_server()->GetURL(test_file));
492 } 510 }
493 511
494 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DeleteCompactsBackingStore) { 512 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DeleteCompactsBackingStore) {
495 const GURL test_url = GetTestUrl("indexeddb", "delete_compact.html"); 513 const GURL test_url = GetTestUrl("indexeddb", "delete_compact.html");
496 SimpleTest(GURL(test_url.spec() + "#fill")); 514 SimpleTest(GURL(test_url.spec() + "#fill"));
497 int64 after_filling = RequestDiskUsage(); 515 int64 after_filling = RequestDiskUsage();
498 EXPECT_GT(after_filling, 0); 516 EXPECT_GT(after_filling, 0);
499 517
500 SimpleTest(GURL(test_url.spec() + "#purge")); 518 SimpleTest(GURL(test_url.spec() + "#purge"));
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 #define MAYBE_RenderThreadShutdownTest DISABLED_RenderThreadShutdownTest 618 #define MAYBE_RenderThreadShutdownTest DISABLED_RenderThreadShutdownTest
601 #else 619 #else
602 #define MAYBE_RenderThreadShutdownTest RenderThreadShutdownTest 620 #define MAYBE_RenderThreadShutdownTest RenderThreadShutdownTest
603 #endif 621 #endif
604 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestSingleProcess, 622 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestSingleProcess,
605 MAYBE_RenderThreadShutdownTest) { 623 MAYBE_RenderThreadShutdownTest) {
606 SimpleTest(GetTestUrl("indexeddb", "shutdown_with_requests.html")); 624 SimpleTest(GetTestUrl("indexeddb", "shutdown_with_requests.html"));
607 } 625 }
608 626
609 } // namespace content 627 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698