| OLD | NEW |
| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "content/public/test/content_browser_test_utils.h" | 37 #include "content/public/test/content_browser_test_utils.h" |
| 38 #include "content/shell/browser/shell.h" | 38 #include "content/shell/browser/shell.h" |
| 39 #include "net/base/escape.h" | 39 #include "net/base/escape.h" |
| 40 #include "net/base/net_errors.h" | 40 #include "net/base/net_errors.h" |
| 41 #include "net/test/embedded_test_server/embedded_test_server.h" | 41 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 42 #include "net/test/embedded_test_server/http_request.h" | 42 #include "net/test/embedded_test_server/http_request.h" |
| 43 #include "net/test/embedded_test_server/http_response.h" | 43 #include "net/test/embedded_test_server/http_response.h" |
| 44 #include "storage/browser/blob/blob_storage_context.h" | 44 #include "storage/browser/blob/blob_storage_context.h" |
| 45 #include "storage/browser/database/database_util.h" | 45 #include "storage/browser/database/database_util.h" |
| 46 #include "storage/browser/quota/quota_manager.h" | 46 #include "storage/browser/quota/quota_manager.h" |
| 47 #include "url/gurl.h" |
| 48 #include "url/origin.h" |
| 47 | 49 |
| 48 using base::ASCIIToUTF16; | 50 using base::ASCIIToUTF16; |
| 49 using storage::QuotaManager; | 51 using storage::QuotaManager; |
| 50 using storage::DatabaseUtil; | 52 using storage::DatabaseUtil; |
| 51 | 53 |
| 52 namespace content { | 54 namespace content { |
| 53 | 55 |
| 54 // This browser test is aimed towards exercising the IndexedDB bindings and | 56 // This browser test is aimed towards exercising the IndexedDB bindings and |
| 55 // the actual implementation that lives in the browser side. | 57 // the actual implementation that lives in the browser side. |
| 56 class IndexedDBBrowserTest : public ContentBrowserTest, | 58 class IndexedDBBrowserTest : public ContentBrowserTest, |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 EXPECT_TRUE(helper->Run()); | 156 EXPECT_TRUE(helper->Run()); |
| 155 // Wait for DidGetDiskUsage to be called. | 157 // Wait for DidGetDiskUsage to be called. |
| 156 base::MessageLoop::current()->RunUntilIdle(); | 158 base::MessageLoop::current()->RunUntilIdle(); |
| 157 return disk_usage_; | 159 return disk_usage_; |
| 158 } | 160 } |
| 159 | 161 |
| 160 virtual int RequestBlobFileCount() { | 162 virtual int RequestBlobFileCount() { |
| 161 PostTaskAndReplyWithResult( | 163 PostTaskAndReplyWithResult( |
| 162 GetContext()->TaskRunner(), FROM_HERE, | 164 GetContext()->TaskRunner(), FROM_HERE, |
| 163 base::Bind(&IndexedDBContextImpl::GetOriginBlobFileCount, GetContext(), | 165 base::Bind(&IndexedDBContextImpl::GetOriginBlobFileCount, GetContext(), |
| 164 GURL("file:///")), | 166 url::Origin(GURL("file:///"))), |
| 165 base::Bind(&IndexedDBBrowserTest::DidGetBlobFileCount, this)); | 167 base::Bind(&IndexedDBBrowserTest::DidGetBlobFileCount, this)); |
| 166 scoped_refptr<base::ThreadTestHelper> helper(new base::ThreadTestHelper( | 168 scoped_refptr<base::ThreadTestHelper> helper(new base::ThreadTestHelper( |
| 167 BrowserMainLoop::GetInstance()->indexed_db_thread()->task_runner())); | 169 BrowserMainLoop::GetInstance()->indexed_db_thread()->task_runner())); |
| 168 EXPECT_TRUE(helper->Run()); | 170 EXPECT_TRUE(helper->Run()); |
| 169 // Wait for DidGetBlobFileCount to be called. | 171 // Wait for DidGetBlobFileCount to be called. |
| 170 base::MessageLoop::current()->RunUntilIdle(); | 172 base::MessageLoop::current()->RunUntilIdle(); |
| 171 return blob_file_count_; | 173 return blob_file_count_; |
| 172 } | 174 } |
| 173 | 175 |
| 174 private: | 176 private: |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 SimpleTest(GetTestUrl("indexeddb", "fill_up_5k.html")); | 433 SimpleTest(GetTestUrl("indexeddb", "fill_up_5k.html")); |
| 432 int64_t size = RequestDiskUsage(); | 434 int64_t size = RequestDiskUsage(); |
| 433 const int kQuotaKilobytes = 2; | 435 const int kQuotaKilobytes = 2; |
| 434 EXPECT_GT(size, kQuotaKilobytes * 1024); | 436 EXPECT_GT(size, kQuotaKilobytes * 1024); |
| 435 SetQuota(kQuotaKilobytes); | 437 SetQuota(kQuotaKilobytes); |
| 436 SimpleTest(GetTestUrl("indexeddb", "delete_over_quota.html")); | 438 SimpleTest(GetTestUrl("indexeddb", "delete_over_quota.html")); |
| 437 } | 439 } |
| 438 | 440 |
| 439 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, EmptyBlob) { | 441 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, EmptyBlob) { |
| 440 // First delete all IDB's for the test origin | 442 // First delete all IDB's for the test origin |
| 443 // TODO(jsbell): Remove static_cast<> when overloads are eliminated. |
| 441 GetContext()->TaskRunner()->PostTask( | 444 GetContext()->TaskRunner()->PostTask( |
| 442 FROM_HERE, base::Bind(&IndexedDBContextImpl::DeleteForOrigin, | 445 FROM_HERE, |
| 443 GetContext(), GURL("file:///"))); | 446 base::Bind(static_cast<void (IndexedDBContextImpl::*)(const GURL&)>( |
| 447 &IndexedDBContextImpl::DeleteForOrigin), |
| 448 GetContext(), GURL("file:///"))); |
| 444 EXPECT_EQ(0, RequestBlobFileCount()); // Start with no blob files. | 449 EXPECT_EQ(0, RequestBlobFileCount()); // Start with no blob files. |
| 445 const GURL test_url = GetTestUrl("indexeddb", "empty_blob.html"); | 450 const GURL test_url = GetTestUrl("indexeddb", "empty_blob.html"); |
| 446 // For some reason Android's futimes fails (EPERM) in this test. Do not assert | 451 // For some reason Android's futimes fails (EPERM) in this test. Do not assert |
| 447 // file times on Android, but do so on other platforms. crbug.com/467247 | 452 // file times on Android, but do so on other platforms. crbug.com/467247 |
| 448 // TODO(cmumford): Figure out why this is the case and fix if possible. | 453 // TODO(cmumford): Figure out why this is the case and fix if possible. |
| 449 #if defined(OS_ANDROID) | 454 #if defined(OS_ANDROID) |
| 450 SimpleTest(GURL(test_url.spec() + "#ignoreTimes")); | 455 SimpleTest(GURL(test_url.spec() + "#ignoreTimes")); |
| 451 #else | 456 #else |
| 452 SimpleTest(GURL(test_url.spec())); | 457 SimpleTest(GURL(test_url.spec())); |
| 453 #endif | 458 #endif |
| (...skipping 28 matching lines...) Expand all Loading... |
| 482 | 487 |
| 483 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, BlobsCountAgainstQuota) { | 488 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, BlobsCountAgainstQuota) { |
| 484 SimpleTest(GetTestUrl("indexeddb", "blobs_use_quota.html")); | 489 SimpleTest(GetTestUrl("indexeddb", "blobs_use_quota.html")); |
| 485 } | 490 } |
| 486 | 491 |
| 487 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DeleteForOriginDeletesBlobs) { | 492 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DeleteForOriginDeletesBlobs) { |
| 488 SimpleTest(GetTestUrl("indexeddb", "write_20mb_blob.html")); | 493 SimpleTest(GetTestUrl("indexeddb", "write_20mb_blob.html")); |
| 489 int64_t size = RequestDiskUsage(); | 494 int64_t size = RequestDiskUsage(); |
| 490 // This assertion assumes that we do not compress blobs. | 495 // This assertion assumes that we do not compress blobs. |
| 491 EXPECT_GT(size, 20 << 20 /* 20 MB */); | 496 EXPECT_GT(size, 20 << 20 /* 20 MB */); |
| 497 // TODO(jsbell): Remove static_cast<> when overloads are eliminated. |
| 492 GetContext()->TaskRunner()->PostTask( | 498 GetContext()->TaskRunner()->PostTask( |
| 493 FROM_HERE, base::Bind(&IndexedDBContextImpl::DeleteForOrigin, | 499 FROM_HERE, |
| 494 GetContext(), GURL("file:///"))); | 500 base::Bind(static_cast<void (IndexedDBContextImpl::*)(const GURL&)>( |
| 501 &IndexedDBContextImpl::DeleteForOrigin), |
| 502 GetContext(), GURL("file:///"))); |
| 495 scoped_refptr<base::ThreadTestHelper> helper(new base::ThreadTestHelper( | 503 scoped_refptr<base::ThreadTestHelper> helper(new base::ThreadTestHelper( |
| 496 BrowserMainLoop::GetInstance()->indexed_db_thread()->task_runner())); | 504 BrowserMainLoop::GetInstance()->indexed_db_thread()->task_runner())); |
| 497 ASSERT_TRUE(helper->Run()); | 505 ASSERT_TRUE(helper->Run()); |
| 498 EXPECT_EQ(0, RequestDiskUsage()); | 506 EXPECT_EQ(0, RequestDiskUsage()); |
| 499 } | 507 } |
| 500 | 508 |
| 501 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DiskFullOnCommit) { | 509 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DiskFullOnCommit) { |
| 502 // Ignore several preceding transactions: | 510 // Ignore several preceding transactions: |
| 503 // * The test calls deleteDatabase() which opens the backing store: | 511 // * The test calls deleteDatabase() which opens the backing store: |
| 504 // #1: IndexedDBBackingStore::OpenBackingStore | 512 // #1: IndexedDBBackingStore::OpenBackingStore |
| (...skipping 11 matching lines...) Expand all Loading... |
| 516 const int call_num = 1; | 524 const int call_num = 1; |
| 517 FailOperation(FAIL_CLASS_LEVELDB_TRANSACTION, FAIL_METHOD_COMMIT_DISK_FULL, | 525 FailOperation(FAIL_CLASS_LEVELDB_TRANSACTION, FAIL_METHOD_COMMIT_DISK_FULL, |
| 518 instance_num, call_num); | 526 instance_num, call_num); |
| 519 SimpleTest(GetTestUrl("indexeddb", "disk_full_on_commit.html")); | 527 SimpleTest(GetTestUrl("indexeddb", "disk_full_on_commit.html")); |
| 520 } | 528 } |
| 521 | 529 |
| 522 namespace { | 530 namespace { |
| 523 | 531 |
| 524 static void CompactIndexedDBBackingStore( | 532 static void CompactIndexedDBBackingStore( |
| 525 scoped_refptr<IndexedDBContextImpl> context, | 533 scoped_refptr<IndexedDBContextImpl> context, |
| 526 const GURL& origin_url) { | 534 const url::Origin& origin) { |
| 527 IndexedDBFactory* factory = context->GetIDBFactory(); | 535 IndexedDBFactory* factory = context->GetIDBFactory(); |
| 528 | 536 |
| 529 std::pair<IndexedDBFactory::OriginDBMapIterator, | 537 std::pair<IndexedDBFactory::OriginDBMapIterator, |
| 530 IndexedDBFactory::OriginDBMapIterator> range = | 538 IndexedDBFactory::OriginDBMapIterator> |
| 531 factory->GetOpenDatabasesForOrigin(origin_url); | 539 range = factory->GetOpenDatabasesForOrigin(origin); |
| 532 | 540 |
| 533 if (range.first == range.second) // If no open db's for this origin | 541 if (range.first == range.second) // If no open db's for this origin |
| 534 return; | 542 return; |
| 535 | 543 |
| 536 // Compact the first db's backing store since all the db's are in the same | 544 // Compact the first db's backing store since all the db's are in the same |
| 537 // backing store. | 545 // backing store. |
| 538 IndexedDBDatabase* db = range.first->second; | 546 IndexedDBDatabase* db = range.first->second; |
| 539 IndexedDBBackingStore* backing_store = db->backing_store(); | 547 IndexedDBBackingStore* backing_store = db->backing_store(); |
| 540 backing_store->Compact(); | 548 backing_store->Compact(); |
| 541 } | 549 } |
| 542 | 550 |
| 543 static void CorruptIndexedDBDatabase( | 551 static void CorruptIndexedDBDatabase( |
| 544 IndexedDBContextImpl* context, | 552 IndexedDBContextImpl* context, |
| 545 const GURL& origin_url, | 553 const url::Origin& origin, |
| 546 base::WaitableEvent* signal_when_finished) { | 554 base::WaitableEvent* signal_when_finished) { |
| 547 | 555 CompactIndexedDBBackingStore(context, origin); |
| 548 CompactIndexedDBBackingStore(context, origin_url); | |
| 549 | 556 |
| 550 int num_files = 0; | 557 int num_files = 0; |
| 551 int num_errors = 0; | 558 int num_errors = 0; |
| 552 const bool recursive = false; | 559 const bool recursive = false; |
| 553 for (const base::FilePath& idb_data_path : | 560 for (const base::FilePath& idb_data_path : context->GetStoragePaths(origin)) { |
| 554 context->GetStoragePaths(origin_url)) { | |
| 555 base::FileEnumerator enumerator( | 561 base::FileEnumerator enumerator( |
| 556 idb_data_path, recursive, base::FileEnumerator::FILES); | 562 idb_data_path, recursive, base::FileEnumerator::FILES); |
| 557 for (base::FilePath idb_file = enumerator.Next(); !idb_file.empty(); | 563 for (base::FilePath idb_file = enumerator.Next(); !idb_file.empty(); |
| 558 idb_file = enumerator.Next()) { | 564 idb_file = enumerator.Next()) { |
| 559 int64_t size(0); | 565 int64_t size(0); |
| 560 GetFileSize(idb_file, &size); | 566 GetFileSize(idb_file, &size); |
| 561 | 567 |
| 562 if (idb_file.Extension() == FILE_PATH_LITERAL(".ldb")) { | 568 if (idb_file.Extension() == FILE_PATH_LITERAL(".ldb")) { |
| 563 num_files++; | 569 num_files++; |
| 564 base::File file( | 570 base::File file( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 576 << " with " << num_errors << " errors"; | 582 << " with " << num_errors << " errors"; |
| 577 } | 583 } |
| 578 | 584 |
| 579 signal_when_finished->Signal(); | 585 signal_when_finished->Signal(); |
| 580 } | 586 } |
| 581 | 587 |
| 582 const std::string s_corrupt_db_test_prefix = "/corrupt/test/"; | 588 const std::string s_corrupt_db_test_prefix = "/corrupt/test/"; |
| 583 | 589 |
| 584 static scoped_ptr<net::test_server::HttpResponse> CorruptDBRequestHandler( | 590 static scoped_ptr<net::test_server::HttpResponse> CorruptDBRequestHandler( |
| 585 IndexedDBContextImpl* context, | 591 IndexedDBContextImpl* context, |
| 586 const GURL& origin_url, | 592 const url::Origin& origin, |
| 587 const std::string& path, | 593 const std::string& path, |
| 588 IndexedDBBrowserTest* test, | 594 IndexedDBBrowserTest* test, |
| 589 const net::test_server::HttpRequest& request) { | 595 const net::test_server::HttpRequest& request) { |
| 590 std::string request_path; | 596 std::string request_path; |
| 591 if (path.find(s_corrupt_db_test_prefix) != std::string::npos) | 597 if (path.find(s_corrupt_db_test_prefix) != std::string::npos) |
| 592 request_path = request.relative_url.substr(s_corrupt_db_test_prefix.size()); | 598 request_path = request.relative_url.substr(s_corrupt_db_test_prefix.size()); |
| 593 else | 599 else |
| 594 return scoped_ptr<net::test_server::HttpResponse>(); | 600 return scoped_ptr<net::test_server::HttpResponse>(); |
| 595 | 601 |
| 596 // Remove the query string if present. | 602 // Remove the query string if present. |
| 597 std::string request_query; | 603 std::string request_query; |
| 598 size_t query_pos = request_path.find('?'); | 604 size_t query_pos = request_path.find('?'); |
| 599 if (query_pos != std::string::npos) { | 605 if (query_pos != std::string::npos) { |
| 600 request_query = request_path.substr(query_pos + 1); | 606 request_query = request_path.substr(query_pos + 1); |
| 601 request_path = request_path.substr(0, query_pos); | 607 request_path = request_path.substr(0, query_pos); |
| 602 } | 608 } |
| 603 | 609 |
| 604 if (request_path == "corruptdb" && !request_query.empty()) { | 610 if (request_path == "corruptdb" && !request_query.empty()) { |
| 605 VLOG(0) << "Requested to corrupt IndexedDB: " << request_query; | 611 VLOG(0) << "Requested to corrupt IndexedDB: " << request_query; |
| 606 base::WaitableEvent signal_when_finished(false, false); | 612 base::WaitableEvent signal_when_finished(false, false); |
| 607 context->TaskRunner()->PostTask(FROM_HERE, | 613 context->TaskRunner()->PostTask( |
| 608 base::Bind(&CorruptIndexedDBDatabase, | 614 FROM_HERE, |
| 609 base::ConstRef(context), | 615 base::Bind(&CorruptIndexedDBDatabase, base::ConstRef(context), origin, |
| 610 origin_url, | 616 &signal_when_finished)); |
| 611 &signal_when_finished)); | |
| 612 signal_when_finished.Wait(); | 617 signal_when_finished.Wait(); |
| 613 | 618 |
| 614 scoped_ptr<net::test_server::BasicHttpResponse> http_response( | 619 scoped_ptr<net::test_server::BasicHttpResponse> http_response( |
| 615 new net::test_server::BasicHttpResponse); | 620 new net::test_server::BasicHttpResponse); |
| 616 http_response->set_code(net::HTTP_OK); | 621 http_response->set_code(net::HTTP_OK); |
| 617 return std::move(http_response); | 622 return std::move(http_response); |
| 618 } else if (request_path == "fail" && !request_query.empty()) { | 623 } else if (request_path == "fail" && !request_query.empty()) { |
| 619 FailClass failure_class = FAIL_CLASS_NOTHING; | 624 FailClass failure_class = FAIL_CLASS_NOTHING; |
| 620 FailMethod failure_method = FAIL_METHOD_NOTHING; | 625 FailMethod failure_method = FAIL_METHOD_NOTHING; |
| 621 int instance_num = 1; | 626 int instance_num = 1; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 return scoped_ptr<net::test_server::HttpResponse>(); | 699 return scoped_ptr<net::test_server::HttpResponse>(); |
| 695 http_response->set_content(file_contents); | 700 http_response->set_content(file_contents); |
| 696 return std::move(http_response); | 701 return std::move(http_response); |
| 697 } | 702 } |
| 698 | 703 |
| 699 } // namespace | 704 } // namespace |
| 700 | 705 |
| 701 IN_PROC_BROWSER_TEST_P(IndexedDBBrowserTest, OperationOnCorruptedOpenDatabase) { | 706 IN_PROC_BROWSER_TEST_P(IndexedDBBrowserTest, OperationOnCorruptedOpenDatabase) { |
| 702 ASSERT_TRUE(embedded_test_server()->Started() || | 707 ASSERT_TRUE(embedded_test_server()->Started() || |
| 703 embedded_test_server()->Start()); | 708 embedded_test_server()->Start()); |
| 704 const GURL& origin_url = embedded_test_server()->base_url(); | 709 const url::Origin origin(embedded_test_server()->base_url()); |
| 705 embedded_test_server()->RegisterRequestHandler( | 710 embedded_test_server()->RegisterRequestHandler( |
| 706 base::Bind(&CorruptDBRequestHandler, | 711 base::Bind(&CorruptDBRequestHandler, base::Unretained(GetContext()), |
| 707 base::Unretained(GetContext()), | 712 origin, s_corrupt_db_test_prefix, this)); |
| 708 origin_url, | |
| 709 s_corrupt_db_test_prefix, | |
| 710 this)); | |
| 711 | 713 |
| 712 std::string test_file = s_corrupt_db_test_prefix + | 714 std::string test_file = s_corrupt_db_test_prefix + |
| 713 "corrupted_open_db_detection.html#" + GetParam(); | 715 "corrupted_open_db_detection.html#" + GetParam(); |
| 714 SimpleTest(embedded_test_server()->GetURL(test_file)); | 716 SimpleTest(embedded_test_server()->GetURL(test_file)); |
| 715 | 717 |
| 716 test_file = s_corrupt_db_test_prefix + "corrupted_open_db_recovery.html"; | 718 test_file = s_corrupt_db_test_prefix + "corrupted_open_db_recovery.html"; |
| 717 SimpleTest(embedded_test_server()->GetURL(test_file)); | 719 SimpleTest(embedded_test_server()->GetURL(test_file)); |
| 718 } | 720 } |
| 719 | 721 |
| 720 INSTANTIATE_TEST_CASE_P(IndexedDBBrowserTestInstantiation, | 722 INSTANTIATE_TEST_CASE_P(IndexedDBBrowserTestInstantiation, |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 shell()->Close(); | 826 shell()->Close(); |
| 825 | 827 |
| 826 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); | 828 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); |
| 827 } | 829 } |
| 828 | 830 |
| 829 // Verify that a "close" event is fired at database connections when | 831 // Verify that a "close" event is fired at database connections when |
| 830 // the backing store is deleted. | 832 // the backing store is deleted. |
| 831 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, ForceCloseEventTest) { | 833 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, ForceCloseEventTest) { |
| 832 NavigateAndWaitForTitle(shell(), "force_close_event.html", NULL, | 834 NavigateAndWaitForTitle(shell(), "force_close_event.html", NULL, |
| 833 "connection ready"); | 835 "connection ready"); |
| 834 | 836 // TODO(jsbell): Remove static_cast<> when overloads are eliminated. |
| 835 GetContext()->TaskRunner()->PostTask( | 837 GetContext()->TaskRunner()->PostTask( |
| 836 FROM_HERE, | 838 FROM_HERE, |
| 837 base::Bind(&IndexedDBContextImpl::DeleteForOrigin, | 839 base::Bind(static_cast<void (IndexedDBContextImpl::*)(const GURL&)>( |
| 838 GetContext(), | 840 &IndexedDBContextImpl::DeleteForOrigin), |
| 839 GURL("file:///"))); | 841 GetContext(), GURL("file:///"))); |
| 840 | 842 |
| 841 base::string16 expected_title16(ASCIIToUTF16("connection closed")); | 843 base::string16 expected_title16(ASCIIToUTF16("connection closed")); |
| 842 TitleWatcher title_watcher(shell()->web_contents(), expected_title16); | 844 TitleWatcher title_watcher(shell()->web_contents(), expected_title16); |
| 843 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("connection closed with error")); | 845 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("connection closed with error")); |
| 844 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); | 846 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); |
| 845 } | 847 } |
| 846 | 848 |
| 847 class IndexedDBBrowserTestSingleProcess : public IndexedDBBrowserTest { | 849 class IndexedDBBrowserTestSingleProcess : public IndexedDBBrowserTest { |
| 848 public: | 850 public: |
| 849 void SetUpCommandLine(base::CommandLine* command_line) override { | 851 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 850 command_line->AppendSwitch(switches::kSingleProcess); | 852 command_line->AppendSwitch(switches::kSingleProcess); |
| 851 } | 853 } |
| 852 }; | 854 }; |
| 853 | 855 |
| 854 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestSingleProcess, | 856 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestSingleProcess, |
| 855 RenderThreadShutdownTest) { | 857 RenderThreadShutdownTest) { |
| 856 SimpleTest(GetTestUrl("indexeddb", "shutdown_with_requests.html")); | 858 SimpleTest(GetTestUrl("indexeddb", "shutdown_with_requests.html")); |
| 857 } | 859 } |
| 858 | 860 |
| 859 } // namespace content | 861 } // namespace content |
| OLD | NEW |