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

Side by Side Diff: sync/syncable/syncable_unittest.cc

Issue 14113050: sync: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « sync/sessions/sync_session_unittest.cc ('k') | sync/test/engine/fake_sync_scheduler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 static const char kIndexTestName[]; 90 static const char kIndexTestName[];
91 virtual void SetUp() { 91 virtual void SetUp() {
92 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 92 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
93 db_path_ = temp_dir_.path().Append( 93 db_path_ = temp_dir_.path().Append(
94 FILE_PATH_LITERAL("SyncableTest.sqlite3")); 94 FILE_PATH_LITERAL("SyncableTest.sqlite3"));
95 } 95 }
96 96
97 virtual void TearDown() { 97 virtual void TearDown() {
98 } 98 }
99 protected: 99 protected:
100 MessageLoop message_loop_; 100 base::MessageLoop message_loop_;
101 base::ScopedTempDir temp_dir_; 101 base::ScopedTempDir temp_dir_;
102 NullDirectoryChangeDelegate delegate_; 102 NullDirectoryChangeDelegate delegate_;
103 FakeEncryptor encryptor_; 103 FakeEncryptor encryptor_;
104 TestUnrecoverableErrorHandler handler_; 104 TestUnrecoverableErrorHandler handler_;
105 base::FilePath db_path_; 105 base::FilePath db_path_;
106 }; 106 };
107 107
108 const char SyncableGeneralTest::kIndexTestName[] = "IndexTest"; 108 const char SyncableGeneralTest::kIndexTestName[] = "IndexTest";
109 109
110 TEST_F(SyncableGeneralTest, General) { 110 TEST_F(SyncableGeneralTest, General) {
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 // for bookmark ordering. Please make sure you know what you're doing if 439 // for bookmark ordering. Please make sure you know what you're doing if
440 // you intend to make such a change. 440 // you intend to make such a change.
441 ASSERT_EQ("6wHRAb3kbnXV5GHrejp4/c1y5tw=", bm.Get(UNIQUE_BOOKMARK_TAG)); 441 ASSERT_EQ("6wHRAb3kbnXV5GHrejp4/c1y5tw=", bm.Get(UNIQUE_BOOKMARK_TAG));
442 } 442 }
443 } 443 }
444 444
445 // A test fixture for syncable::Directory. Uses an in-memory database to keep 445 // A test fixture for syncable::Directory. Uses an in-memory database to keep
446 // the unit tests fast. 446 // the unit tests fast.
447 class SyncableDirectoryTest : public testing::Test { 447 class SyncableDirectoryTest : public testing::Test {
448 protected: 448 protected:
449 MessageLoop message_loop_; 449 base::MessageLoop message_loop_;
450 static const char kName[]; 450 static const char kName[];
451 451
452 virtual void SetUp() { 452 virtual void SetUp() {
453 dir_.reset(new Directory(new InMemoryDirectoryBackingStore(kName), 453 dir_.reset(new Directory(new InMemoryDirectoryBackingStore(kName),
454 &handler_, 454 &handler_,
455 NULL, 455 NULL,
456 NULL, 456 NULL,
457 NULL)); 457 NULL));
458 ASSERT_TRUE(dir_.get()); 458 ASSERT_TRUE(dir_.get());
459 ASSERT_EQ(OPENED, dir_->Open(kName, &delegate_, 459 ASSERT_EQ(OPENED, dir_->Open(kName, &delegate_,
(...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after
2096 2096
2097 class SyncableDirectoryManagement : public testing::Test { 2097 class SyncableDirectoryManagement : public testing::Test {
2098 public: 2098 public:
2099 virtual void SetUp() { 2099 virtual void SetUp() {
2100 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 2100 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
2101 } 2101 }
2102 2102
2103 virtual void TearDown() { 2103 virtual void TearDown() {
2104 } 2104 }
2105 protected: 2105 protected:
2106 MessageLoop message_loop_; 2106 base::MessageLoop message_loop_;
2107 base::ScopedTempDir temp_dir_; 2107 base::ScopedTempDir temp_dir_;
2108 FakeEncryptor encryptor_; 2108 FakeEncryptor encryptor_;
2109 TestUnrecoverableErrorHandler handler_; 2109 TestUnrecoverableErrorHandler handler_;
2110 NullDirectoryChangeDelegate delegate_; 2110 NullDirectoryChangeDelegate delegate_;
2111 }; 2111 };
2112 2112
2113 TEST_F(SyncableDirectoryManagement, TestFileRelease) { 2113 TEST_F(SyncableDirectoryManagement, TestFileRelease) {
2114 base::FilePath path = temp_dir_.path().Append( 2114 base::FilePath path = temp_dir_.path().Append(
2115 Directory::kSyncDatabaseFilename); 2115 Directory::kSyncDatabaseFilename);
2116 2116
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2165 e.Put(BASE_VERSION, 1); 2165 e.Put(BASE_VERSION, 1);
2166 } 2166 }
2167 } 2167 }
2168 } 2168 }
2169 } 2169 }
2170 2170
2171 DISALLOW_COPY_AND_ASSIGN(StressTransactionsDelegate); 2171 DISALLOW_COPY_AND_ASSIGN(StressTransactionsDelegate);
2172 }; 2172 };
2173 2173
2174 TEST(SyncableDirectory, StressTransactions) { 2174 TEST(SyncableDirectory, StressTransactions) {
2175 MessageLoop message_loop; 2175 base::MessageLoop message_loop;
2176 base::ScopedTempDir temp_dir; 2176 base::ScopedTempDir temp_dir;
2177 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 2177 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
2178 FakeEncryptor encryptor; 2178 FakeEncryptor encryptor;
2179 TestUnrecoverableErrorHandler handler; 2179 TestUnrecoverableErrorHandler handler;
2180 NullDirectoryChangeDelegate delegate; 2180 NullDirectoryChangeDelegate delegate;
2181 std::string dirname = "stress"; 2181 std::string dirname = "stress";
2182 Directory dir(new InMemoryDirectoryBackingStore(dirname), 2182 Directory dir(new InMemoryDirectoryBackingStore(dirname),
2183 &handler, 2183 &handler,
2184 NULL, 2184 NULL,
2185 NULL, 2185 NULL,
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
2294 EXPECT_TRUE(CreateWithDefaultTag(factory_.NewServerId(), true)); 2294 EXPECT_TRUE(CreateWithDefaultTag(factory_.NewServerId(), true));
2295 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), true)); 2295 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), true));
2296 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), false)); 2296 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), false));
2297 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), false)); 2297 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), false));
2298 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), true)); 2298 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), true));
2299 } 2299 }
2300 2300
2301 } // namespace 2301 } // namespace
2302 } // namespace syncable 2302 } // namespace syncable
2303 } // namespace syncer 2303 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/sessions/sync_session_unittest.cc ('k') | sync/test/engine/fake_sync_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698