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

Side by Side Diff: content/browser/database_tracker_unittest.cc

Issue 1170623003: Revert "content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/files/file.h" 5 #include "base/files/file.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/message_loop/message_loop_proxy.h"
11 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
12 #include "base/thread_task_runner_handle.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "content/public/test/mock_special_storage_policy.h" 14 #include "content/public/test/mock_special_storage_policy.h"
15 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
16 #include "net/base/test_completion_callback.h" 16 #include "net/base/test_completion_callback.h"
17 #include "storage/browser/database/database_tracker.h" 17 #include "storage/browser/database/database_tracker.h"
18 #include "storage/browser/quota/quota_manager_proxy.h" 18 #include "storage/browser/quota/quota_manager_proxy.h"
19 #include "storage/common/database/database_identifier.h" 19 #include "storage/common/database/database_identifier.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 #include "third_party/sqlite/sqlite3.h" 21 #include "third_party/sqlite/sqlite3.h"
22 22
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 // Initialize the tracker database. 557 // Initialize the tracker database.
558 base::MessageLoop message_loop; 558 base::MessageLoop message_loop;
559 base::ScopedTempDir temp_dir; 559 base::ScopedTempDir temp_dir;
560 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 560 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
561 base::FilePath origin1_db_dir; 561 base::FilePath origin1_db_dir;
562 base::FilePath origin2_db_dir; 562 base::FilePath origin2_db_dir;
563 { 563 {
564 scoped_refptr<MockSpecialStoragePolicy> special_storage_policy = 564 scoped_refptr<MockSpecialStoragePolicy> special_storage_policy =
565 new MockSpecialStoragePolicy; 565 new MockSpecialStoragePolicy;
566 special_storage_policy->AddSessionOnly(GURL(kOrigin2Url)); 566 special_storage_policy->AddSessionOnly(GURL(kOrigin2Url));
567 scoped_refptr<DatabaseTracker> tracker(new DatabaseTracker( 567 scoped_refptr<DatabaseTracker> tracker(
568 temp_dir.path(), false, special_storage_policy.get(), NULL, 568 new DatabaseTracker(temp_dir.path(),
569 base::ThreadTaskRunnerHandle::Get().get())); 569 false,
570 special_storage_policy.get(),
571 NULL,
572 base::MessageLoopProxy::current().get()));
570 573
571 // Open two new databases. 574 // Open two new databases.
572 tracker->DatabaseOpened(kOrigin1, kDB1, kDescription, 0, 575 tracker->DatabaseOpened(kOrigin1, kDB1, kDescription, 0,
573 &database_size); 576 &database_size);
574 EXPECT_EQ(0, database_size); 577 EXPECT_EQ(0, database_size);
575 tracker->DatabaseOpened(kOrigin2, kDB2, kDescription, 0, 578 tracker->DatabaseOpened(kOrigin2, kDB2, kDescription, 0,
576 &database_size); 579 &database_size);
577 EXPECT_EQ(0, database_size); 580 EXPECT_EQ(0, database_size);
578 581
579 // Write some data to each file. 582 // Write some data to each file.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 // Initialize the tracker database. 637 // Initialize the tracker database.
635 base::MessageLoop message_loop; 638 base::MessageLoop message_loop;
636 base::ScopedTempDir temp_dir; 639 base::ScopedTempDir temp_dir;
637 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 640 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
638 base::FilePath origin1_db_dir; 641 base::FilePath origin1_db_dir;
639 base::FilePath origin2_db_dir; 642 base::FilePath origin2_db_dir;
640 { 643 {
641 scoped_refptr<MockSpecialStoragePolicy> special_storage_policy = 644 scoped_refptr<MockSpecialStoragePolicy> special_storage_policy =
642 new MockSpecialStoragePolicy; 645 new MockSpecialStoragePolicy;
643 special_storage_policy->AddSessionOnly(GURL(kOrigin2Url)); 646 special_storage_policy->AddSessionOnly(GURL(kOrigin2Url));
644 scoped_refptr<DatabaseTracker> tracker(new DatabaseTracker( 647 scoped_refptr<DatabaseTracker> tracker(
645 temp_dir.path(), false, special_storage_policy.get(), NULL, 648 new DatabaseTracker(temp_dir.path(),
646 base::ThreadTaskRunnerHandle::Get().get())); 649 false,
650 special_storage_policy.get(),
651 NULL,
652 base::MessageLoopProxy::current().get()));
647 tracker->SetForceKeepSessionState(); 653 tracker->SetForceKeepSessionState();
648 654
649 // Open two new databases. 655 // Open two new databases.
650 tracker->DatabaseOpened(kOrigin1, kDB1, kDescription, 0, 656 tracker->DatabaseOpened(kOrigin1, kDB1, kDescription, 0,
651 &database_size); 657 &database_size);
652 EXPECT_EQ(0, database_size); 658 EXPECT_EQ(0, database_size);
653 tracker->DatabaseOpened(kOrigin2, kDB2, kDescription, 0, 659 tracker->DatabaseOpened(kOrigin2, kDB2, kDescription, 0,
654 &database_size); 660 &database_size);
655 EXPECT_EQ(0, database_size); 661 EXPECT_EQ(0, database_size);
656 662
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 860
855 TEST(DatabaseTrackerTest, EmptyDatabaseNameIsValid) { 861 TEST(DatabaseTrackerTest, EmptyDatabaseNameIsValid) {
856 DatabaseTracker_TestHelper_Test::EmptyDatabaseNameIsValid(); 862 DatabaseTracker_TestHelper_Test::EmptyDatabaseNameIsValid();
857 } 863 }
858 864
859 TEST(DatabaseTrackerTest, HandleSqliteError) { 865 TEST(DatabaseTrackerTest, HandleSqliteError) {
860 DatabaseTracker_TestHelper_Test::HandleSqliteError(); 866 DatabaseTracker_TestHelper_Test::HandleSqliteError();
861 } 867 }
862 868
863 } // namespace content 869 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/database_quota_client_unittest.cc ('k') | content/browser/device_sensors/data_fetcher_shared_memory_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698