diff options
author | zork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-07 23:46:56 +0000 |
---|---|---|
committer | zork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-07 23:46:56 +0000 |
commit | 28d0c9c14970a0e1c3c6dcc0746529446c692393 (patch) | |
tree | 528fac009ac1b174d48b880af2c3acc363fc34e8 /chrome | |
parent | 19b4dbf7f2fd0e5db31accb599c97c042a043b07 (diff) | |
download | chromium_src-28d0c9c14970a0e1c3c6dcc0746529446c692393.zip chromium_src-28d0c9c14970a0e1c3c6dcc0746529446c692393.tar.gz chromium_src-28d0c9c14970a0e1c3c6dcc0746529446c692393.tar.bz2 |
Update sync unit tests to build on linux
Review URL: http://codereview.chromium.org/218014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28349 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/sync/engine/all_status.cc | 2 | ||||
-rw-r--r-- | chrome/browser/sync/engine/all_status.h | 2 | ||||
-rw-r--r-- | chrome/browser/sync/engine/syncer_proto_util_unittest.cc | 6 | ||||
-rw-r--r-- | chrome/browser/sync/engine/syncer_thread_unittest.cc | 249 | ||||
-rw-r--r-- | chrome/browser/sync/engine/syncer_unittest.cc | 601 | ||||
-rw-r--r-- | chrome/browser/sync/glue/http_bridge_unittest.cc | 22 | ||||
-rw-r--r-- | chrome/browser/sync/notifier/listener/talk_mediator_unittest.cc | 92 | ||||
-rw-r--r-- | chrome/browser/sync/syncable/syncable_unittest.cc | 460 | ||||
-rw-r--r-- | chrome/browser/sync/util/highres_timer_unittest.cc | 14 | ||||
-rw-r--r-- | chrome/browser/sync/util/user_settings_unittest.cc | 34 | ||||
-rw-r--r-- | chrome/browser/views/sync/sync_setup_wizard_unittest.cc | 7 | ||||
-rw-r--r-- | chrome/test/sync/engine/mock_gaia_authenticator.cc | 2 |
12 files changed, 549 insertions, 942 deletions
diff --git a/chrome/browser/sync/engine/all_status.cc b/chrome/browser/sync/engine/all_status.cc index 4ee697b..d5b2a2b1 100644 --- a/chrome/browser/sync/engine/all_status.cc +++ b/chrome/browser/sync/engine/all_status.cc @@ -27,6 +27,8 @@ static const time_t kMinSyncObserveInterval = 10; // seconds // Backoff interval randomization factor. static const int kBackoffRandomizationFactor = 2; +const int AllStatus::kMaxBackoffSeconds = 60 * 60 * 4; // 4 hours. + const char* AllStatus::GetSyncStatusString(SyncStatus icon) { const char* strings[] = {"OFFLINE", "OFFLINE_UNSYNCED", "SYNCING", "READY", "CONFLICT", "OFFLINE_UNUSABLE"}; diff --git a/chrome/browser/sync/engine/all_status.h b/chrome/browser/sync/engine/all_status.h index b5023a5..29691ec 100644 --- a/chrome/browser/sync/engine/all_status.h +++ b/chrome/browser/sync/engine/all_status.h @@ -92,7 +92,7 @@ class AllStatus { }; // Maximum interval for exponential backoff. - static const int kMaxBackoffSeconds = 60 * 60 * 4; // 4 hours. + static const int kMaxBackoffSeconds; AllStatus(); ~AllStatus(); diff --git a/chrome/browser/sync/engine/syncer_proto_util_unittest.cc b/chrome/browser/sync/engine/syncer_proto_util_unittest.cc index 1682b05..dbb1730 100644 --- a/chrome/browser/sync/engine/syncer_proto_util_unittest.cc +++ b/chrome/browser/sync/engine/syncer_proto_util_unittest.cc @@ -21,11 +21,11 @@ TEST(SyncerProtoUtil, TestBlobToProtocolBufferBytesUtilityFunctions) { unsigned char test_data3[] = {99, 2, 3, 4, 5, 6, 7, 8}; syncable::Blob test_blob1, test_blob2, test_blob3; - for (int i = 0; i < arraysize(test_data1); ++i) + for (size_t i = 0; i < arraysize(test_data1); ++i) test_blob1.push_back(test_data1[i]); - for (int i = 0; i < arraysize(test_data2); ++i) + for (size_t i = 0; i < arraysize(test_data2); ++i) test_blob2.push_back(test_data2[i]); - for (int i = 0; i < arraysize(test_data3); ++i) + for (size_t i = 0; i < arraysize(test_data3); ++i) test_blob3.push_back(test_data3[i]); string test_message1(reinterpret_cast<char*>(test_data1), diff --git a/chrome/browser/sync/engine/syncer_thread_unittest.cc b/chrome/browser/sync/engine/syncer_thread_unittest.cc index f23b0500..846ad36 100644 --- a/chrome/browser/sync/engine/syncer_thread_unittest.cc +++ b/chrome/browser/sync/engine/syncer_thread_unittest.cc @@ -5,7 +5,6 @@ #include <list> #include <map> #include <set> -#include <strstream> #include "base/command_line.h" #include "base/scoped_ptr.h" @@ -113,27 +112,27 @@ TEST_F(SyncerThreadTest, CalculateSyncWaitTime) { // user_idle_ms is ge than 10 * (syncer_polling_interval*1000). int last_poll_time = 2000; - ASSERT_LE(last_poll_time, - syncer_thread->CalculateSyncWaitTime(last_poll_time, 10000)); - ASSERT_GE(last_poll_time*3, - syncer_thread->CalculateSyncWaitTime(last_poll_time, 10000)); - ASSERT_LE(last_poll_time, - syncer_thread->CalculateSyncWaitTime(last_poll_time, 100000)); - ASSERT_GE(last_poll_time*3, - syncer_thread->CalculateSyncWaitTime(last_poll_time, 100000)); + ASSERT_TRUE(last_poll_time <= + syncer_thread->CalculateSyncWaitTime(last_poll_time, 10000)); + ASSERT_TRUE(last_poll_time * 3 >= + syncer_thread->CalculateSyncWaitTime(last_poll_time, 10000)); + ASSERT_TRUE(last_poll_time <= + syncer_thread->CalculateSyncWaitTime(last_poll_time, 100000)); + ASSERT_TRUE(last_poll_time * 3 >= + syncer_thread->CalculateSyncWaitTime(last_poll_time, 100000)); // Maximum backoff time should be syncer_max_interval. int near_threshold = SyncerThread::kDefaultMaxPollIntervalMs / 2 - 1; int threshold = SyncerThread::kDefaultMaxPollIntervalMs; int over_threshold = SyncerThread::kDefaultMaxPollIntervalMs + 1; - ASSERT_LE(near_threshold, - syncer_thread->CalculateSyncWaitTime(near_threshold, 10000)); - ASSERT_GE(SyncerThread::kDefaultMaxPollIntervalMs, - syncer_thread->CalculateSyncWaitTime(near_threshold, 10000)); - ASSERT_EQ(SyncerThread::kDefaultMaxPollIntervalMs, - syncer_thread->CalculateSyncWaitTime(threshold, 10000)); - ASSERT_EQ(SyncerThread::kDefaultMaxPollIntervalMs, - syncer_thread->CalculateSyncWaitTime(over_threshold, 10000)); + ASSERT_TRUE(near_threshold <= + syncer_thread->CalculateSyncWaitTime(near_threshold, 10000)); + ASSERT_TRUE(SyncerThread::kDefaultMaxPollIntervalMs >= + syncer_thread->CalculateSyncWaitTime(near_threshold, 10000)); + ASSERT_TRUE(SyncerThread::kDefaultMaxPollIntervalMs == + syncer_thread->CalculateSyncWaitTime(threshold, 10000)); + ASSERT_TRUE(SyncerThread::kDefaultMaxPollIntervalMs == + syncer_thread->CalculateSyncWaitTime(over_threshold, 10000)); // Possible idle time must be capped by syncer_max_interval. int over_sync_max_interval = @@ -145,12 +144,12 @@ TEST_F(SyncerThreadTest, CalculateSyncWaitTime) { syncer_thread->CalculateSyncWaitTime(1000, over_sync_max_interval)); syncer_polling_interval = TimeDelta::FromSeconds(1); syncer_thread->SetSyncerPollingInterval(syncer_polling_interval); - ASSERT_LE(last_poll_time, - syncer_thread->CalculateSyncWaitTime(last_poll_time, - over_sync_max_interval)); - ASSERT_GE(last_poll_time * 3, - syncer_thread->CalculateSyncWaitTime(last_poll_time, - over_sync_max_interval)); + ASSERT_TRUE(last_poll_time <= + syncer_thread->CalculateSyncWaitTime(last_poll_time, + over_sync_max_interval)); + ASSERT_TRUE(last_poll_time * 3 >= + syncer_thread->CalculateSyncWaitTime(last_poll_time, + over_sync_max_interval)); } TEST_F(SyncerThreadTest, CalculatePollingWaitTime) { @@ -168,22 +167,22 @@ TEST_F(SyncerThreadTest, CalculatePollingWaitTime) { bool continue_sync_cycle_param = false; // No work and no backoff. - ASSERT_EQ(SyncerThread::kDefaultShortPollIntervalSeconds, - syncer_thread->CalculatePollingWaitTime( - status, - 0, - &user_idle_milliseconds_param, - &continue_sync_cycle_param)); + ASSERT_TRUE(SyncerThread::kDefaultShortPollIntervalSeconds == + syncer_thread->CalculatePollingWaitTime( + status, + 0, + &user_idle_milliseconds_param, + &continue_sync_cycle_param)); ASSERT_FALSE(continue_sync_cycle_param); // In this case the continue_sync_cycle is turned off. continue_sync_cycle_param = true; - ASSERT_EQ(SyncerThread::kDefaultShortPollIntervalSeconds, - syncer_thread->CalculatePollingWaitTime( - status, - 0, - &user_idle_milliseconds_param, - &continue_sync_cycle_param)); + ASSERT_TRUE(SyncerThread::kDefaultShortPollIntervalSeconds == + syncer_thread->CalculatePollingWaitTime( + status, + 0, + &user_idle_milliseconds_param, + &continue_sync_cycle_param)); ASSERT_FALSE(continue_sync_cycle_param); // TODO(brg) : Find a way to test exponential backoff is inoperable. @@ -199,22 +198,22 @@ TEST_F(SyncerThreadTest, CalculatePollingWaitTime) { bool continue_sync_cycle_param = false; // No work and no backoff. - ASSERT_EQ(SyncerThread::kDefaultLongPollIntervalSeconds, - syncer_thread->CalculatePollingWaitTime( - status, - 0, - &user_idle_milliseconds_param, - &continue_sync_cycle_param)); + ASSERT_TRUE(SyncerThread::kDefaultLongPollIntervalSeconds == + syncer_thread->CalculatePollingWaitTime( + status, + 0, + &user_idle_milliseconds_param, + &continue_sync_cycle_param)); ASSERT_FALSE(continue_sync_cycle_param); // In this case the continue_sync_cycle is turned off. continue_sync_cycle_param = true; - ASSERT_EQ(SyncerThread::kDefaultLongPollIntervalSeconds, - syncer_thread->CalculatePollingWaitTime( - status, - 0, - &user_idle_milliseconds_param, - &continue_sync_cycle_param)); + ASSERT_TRUE(SyncerThread::kDefaultLongPollIntervalSeconds == + syncer_thread->CalculatePollingWaitTime( + status, + 0, + &user_idle_milliseconds_param, + &continue_sync_cycle_param)); ASSERT_FALSE(continue_sync_cycle_param); // TODO(brg) : Find a way to test exponential backoff. @@ -231,40 +230,40 @@ TEST_F(SyncerThreadTest, CalculatePollingWaitTime) { status.updates_received = 0; bool continue_sync_cycle_param = false; - ASSERT_LE(0, syncer_thread->CalculatePollingWaitTime( - status, - 0, - &user_idle_milliseconds_param, - &continue_sync_cycle_param)); + ASSERT_TRUE(0 <= syncer_thread->CalculatePollingWaitTime( + status, + 0, + &user_idle_milliseconds_param, + &continue_sync_cycle_param)); ASSERT_TRUE(continue_sync_cycle_param); continue_sync_cycle_param = false; - ASSERT_GE(3, syncer_thread->CalculatePollingWaitTime( - status, - 0, - &user_idle_milliseconds_param, - &continue_sync_cycle_param)); + ASSERT_TRUE(3 >= syncer_thread->CalculatePollingWaitTime( + status, + 0, + &user_idle_milliseconds_param, + &continue_sync_cycle_param)); ASSERT_TRUE(continue_sync_cycle_param); - ASSERT_LE(0, syncer_thread->CalculatePollingWaitTime( - status, - 0, - &user_idle_milliseconds_param, - &continue_sync_cycle_param)); - ASSERT_GE(2, syncer_thread->CalculatePollingWaitTime( - status, - 0, - &user_idle_milliseconds_param, - &continue_sync_cycle_param)); + ASSERT_TRUE(0 <= syncer_thread->CalculatePollingWaitTime( + status, + 0, + &user_idle_milliseconds_param, + &continue_sync_cycle_param)); + ASSERT_TRUE(2 >= syncer_thread->CalculatePollingWaitTime( + status, + 0, + &user_idle_milliseconds_param, + &continue_sync_cycle_param)); ASSERT_TRUE(continue_sync_cycle_param); status.updates_received = 1; - ASSERT_EQ(SyncerThread::kDefaultShortPollIntervalSeconds, - syncer_thread->CalculatePollingWaitTime( - status, - 10, - &user_idle_milliseconds_param, - &continue_sync_cycle_param)); + ASSERT_TRUE(SyncerThread::kDefaultShortPollIntervalSeconds == + syncer_thread->CalculatePollingWaitTime( + status, + 10, + &user_idle_milliseconds_param, + &continue_sync_cycle_param)); ASSERT_FALSE(continue_sync_cycle_param); } @@ -273,28 +272,28 @@ TEST_F(SyncerThreadTest, CalculatePollingWaitTime) { status.unsynced_count = 1; bool continue_sync_cycle_param = false; - ASSERT_LE(0, syncer_thread->CalculatePollingWaitTime( - status, - 0, - &user_idle_milliseconds_param, - &continue_sync_cycle_param)); + ASSERT_TRUE(0 <= syncer_thread->CalculatePollingWaitTime( + status, + 0, + &user_idle_milliseconds_param, + &continue_sync_cycle_param)); ASSERT_TRUE(continue_sync_cycle_param); continue_sync_cycle_param = false; - ASSERT_GE(2, syncer_thread->CalculatePollingWaitTime( - status, - 0, - &user_idle_milliseconds_param, - &continue_sync_cycle_param)); + ASSERT_TRUE(2 >= syncer_thread->CalculatePollingWaitTime( + status, + 0, + &user_idle_milliseconds_param, + &continue_sync_cycle_param)); ASSERT_TRUE(continue_sync_cycle_param); status.unsynced_count = 0; - ASSERT_EQ(SyncerThread::kDefaultShortPollIntervalSeconds, - syncer_thread->CalculatePollingWaitTime( - status, - 4, - &user_idle_milliseconds_param, - &continue_sync_cycle_param)); + ASSERT_TRUE(SyncerThread::kDefaultShortPollIntervalSeconds == + syncer_thread->CalculatePollingWaitTime( + status, + 4, + &user_idle_milliseconds_param, + &continue_sync_cycle_param)); ASSERT_FALSE(continue_sync_cycle_param); } @@ -306,60 +305,60 @@ TEST_F(SyncerThreadTest, CalculatePollingWaitTime) { // Expect move from default polling interval to exponential backoff due to // unsynced_count != 0. - ASSERT_LE(0, syncer_thread->CalculatePollingWaitTime( - status, - 3600, - &user_idle_milliseconds_param, - &continue_sync_cycle_param)); + ASSERT_TRUE(0 <= syncer_thread->CalculatePollingWaitTime( + status, + 3600, + &user_idle_milliseconds_param, + &continue_sync_cycle_param)); ASSERT_TRUE(continue_sync_cycle_param); continue_sync_cycle_param = false; - ASSERT_GE(2, syncer_thread->CalculatePollingWaitTime( - status, - 3600, - &user_idle_milliseconds_param, - &continue_sync_cycle_param)); + ASSERT_TRUE(2 >= syncer_thread->CalculatePollingWaitTime( + status, + 3600, + &user_idle_milliseconds_param, + &continue_sync_cycle_param)); ASSERT_TRUE(continue_sync_cycle_param); // Expect exponential backoff. - ASSERT_LE(2, syncer_thread->CalculatePollingWaitTime( - status, - 2, - &user_idle_milliseconds_param, - &continue_sync_cycle_param)); - ASSERT_GE(6, syncer_thread->CalculatePollingWaitTime( - status, - 2, - &user_idle_milliseconds_param, - &continue_sync_cycle_param)); + ASSERT_TRUE(2 <= syncer_thread->CalculatePollingWaitTime( + status, + 2, + &user_idle_milliseconds_param, + &continue_sync_cycle_param)); + ASSERT_TRUE(6 >= syncer_thread->CalculatePollingWaitTime( + status, + 2, + &user_idle_milliseconds_param, + &continue_sync_cycle_param)); ASSERT_TRUE(continue_sync_cycle_param); // A nudge resets the continue_sync_cycle_param value, so our backoff // should return to the minimum. continue_sync_cycle_param = false; - ASSERT_LE(0, syncer_thread->CalculatePollingWaitTime( - status, - 3600, - &user_idle_milliseconds_param, - &continue_sync_cycle_param)); + ASSERT_TRUE(0 <= syncer_thread->CalculatePollingWaitTime( + status, + 3600, + &user_idle_milliseconds_param, + &continue_sync_cycle_param)); ASSERT_TRUE(continue_sync_cycle_param); continue_sync_cycle_param = false; - ASSERT_GE(2, syncer_thread->CalculatePollingWaitTime( - status, - 3600, - &user_idle_milliseconds_param, - &continue_sync_cycle_param)); + ASSERT_TRUE(2 >= syncer_thread->CalculatePollingWaitTime( + status, + 3600, + &user_idle_milliseconds_param, + &continue_sync_cycle_param)); ASSERT_TRUE(continue_sync_cycle_param); // Setting unsynced_count = 0 returns us to the default polling interval. status.unsynced_count = 0; - ASSERT_EQ(SyncerThread::kDefaultShortPollIntervalSeconds, - syncer_thread->CalculatePollingWaitTime( - status, - 4, - &user_idle_milliseconds_param, - &continue_sync_cycle_param)); + ASSERT_TRUE(SyncerThread::kDefaultShortPollIntervalSeconds == + syncer_thread->CalculatePollingWaitTime( + status, + 4, + &user_idle_milliseconds_param, + &continue_sync_cycle_param)); ASSERT_FALSE(continue_sync_cycle_param); } } diff --git a/chrome/browser/sync/engine/syncer_unittest.cc b/chrome/browser/sync/engine/syncer_unittest.cc index d9d520c..e22cfe6 100644 --- a/chrome/browser/sync/engine/syncer_unittest.cc +++ b/chrome/browser/sync/engine/syncer_unittest.cc @@ -8,7 +8,6 @@ #include <list> #include <map> #include <set> -#include <strstream> #include "base/at_exit.h" @@ -166,7 +165,7 @@ class SyncerTest : public testing::Test { ReadTransaction trans(dir, __FILE__, __LINE__); syncable::Directory::ChildHandles children; dir->GetChildHandles(&trans, trans.root_id(), &children); - ASSERT_EQ(0, children.size()); + ASSERT_TRUE(0 == children.size()); syncer_events_.clear(); root_id_ = ids_.root(); parent_id_ = ids_.MakeServer("parent id"); @@ -196,7 +195,7 @@ class SyncerTest : public testing::Test { ExtendedAttributeKey key(entry->Get(META_HANDLE), PSTR("DATA")); ExtendedAttribute attr(trans, GET_BY_HANDLE, key); EXPECT_FALSE(attr.is_deleted()); - EXPECT_EQ(test_value, attr.value()); + EXPECT_TRUE(test_value == attr.value()); } bool SyncerStuck(SyncProcessState* state) { SyncerStatus status(NULL, state); @@ -265,7 +264,7 @@ class SyncerTest : public testing::Test { int64 now_plus_30s = ServerTimeToClientTime(now_server_time + 30000); int64 now_minus_2h = ServerTimeToClientTime(now_server_time - 7200000); entry.Put(syncable::MTIME, now_plus_30s); - for (int i = 0 ; i < ARRAYSIZE(test->features) ; ++i) { + for (size_t i = 0 ; i < arraysize(test->features) ; ++i) { switch (test->features[i]) { case LIST_END: break; @@ -289,11 +288,12 @@ class SyncerTest : public testing::Test { } } LoopSyncShare(syncer_); - ASSERT_EQ(expected_positions.size(), mock_server_->committed_ids().size()); + ASSERT_TRUE(expected_positions.size() == + mock_server_->committed_ids().size()); // If this test starts failing, be aware other sort orders could be valid. for (size_t i = 0; i < expected_positions.size(); ++i) { - EXPECT_EQ(1, expected_positions.count(i)); - EXPECT_EQ(expected_positions[i], mock_server_->committed_ids()[i]); + EXPECT_TRUE(1 == expected_positions.count(i)); + EXPECT_TRUE(expected_positions[i] == mock_server_->committed_ids()[i]); } } @@ -311,10 +311,10 @@ class SyncerTest : public testing::Test { GetCommitIdsCommand command(limit); command.BuildCommitIds(&session); vector<syncable::Id> output = command.ordered_commit_set_.GetCommitIds(); - int truncated_size = std::min(limit, expected_id_order.size()); - ASSERT_EQ(truncated_size, output.size()); - for (int i = 0; i < truncated_size; ++i) { - ASSERT_EQ(expected_id_order[i], output[i]) + size_t truncated_size = std::min(limit, expected_id_order.size()); + ASSERT_TRUE(truncated_size == output.size()); + for (size_t i = 0; i < truncated_size; ++i) { + ASSERT_TRUE(expected_id_order[i] == output[i]) << "At index " << i << " with batch size limited to " << limit; } } @@ -373,7 +373,7 @@ TEST_F(SyncerTest, TestCallGatherUnsyncedEntries) { ReadTransaction trans(dir, __FILE__, __LINE__); SyncerUtil::GetUnsyncedEntries(&trans, &handles); } - ASSERT_EQ(0, handles.size()); + ASSERT_TRUE(0 == handles.size()); } // TODO(sync): When we can dynamically connect and disconnect the mock // ServerConnectionManager test disconnected GetUnsyncedEntries here. It's a @@ -454,15 +454,15 @@ TEST_F(SyncerTest, TestCommitMetahandleIterator) { &commit_set); EXPECT_TRUE(iterator.Valid()); - EXPECT_EQ(iterator.Current(), session_metahandles[0]); + EXPECT_TRUE(iterator.Current() == session_metahandles[0]); EXPECT_TRUE(iterator.Increment()); EXPECT_TRUE(iterator.Valid()); - EXPECT_EQ(iterator.Current(), session_metahandles[1]); + EXPECT_TRUE(iterator.Current() == session_metahandles[1]); EXPECT_TRUE(iterator.Increment()); EXPECT_TRUE(iterator.Valid()); - EXPECT_EQ(iterator.Current(), session_metahandles[2]); + EXPECT_TRUE(iterator.Current() == session_metahandles[2]); EXPECT_FALSE(iterator.Increment()); EXPECT_FALSE(iterator.Valid()); @@ -493,11 +493,11 @@ TEST_F(SyncerTest, TestGetUnsyncedAndSimpleCommit) { SyncerSession session(&cycle_state, state_.get()); syncer_->SyncShare(&session); - EXPECT_EQ(2, session.unsynced_count()); - ASSERT_EQ(2, mock_server_->committed_ids().size()); + EXPECT_TRUE(2 == session.unsynced_count()); + ASSERT_TRUE(2 == mock_server_->committed_ids().size()); // If this test starts failing, be aware other sort orders could be valid. - EXPECT_EQ(parent_id_, mock_server_->committed_ids()[0]); - EXPECT_EQ(child_id_, mock_server_->committed_ids()[1]); + EXPECT_TRUE(parent_id_ == mock_server_->committed_ids()[0]); + EXPECT_TRUE(child_id_ == mock_server_->committed_ids()[1]); { ReadTransaction rt(dir, __FILE__, __LINE__); Entry entry(&rt, syncable::GET_BY_ID, child_id_); @@ -700,20 +700,20 @@ TEST_F(SyncerTest, TestCommitListOrderingWithNesting) { SyncCycleState cycle_state; SyncerSession session(&cycle_state, state_.get()); syncer_->SyncShare(&session); - EXPECT_EQ(6, session.unsynced_count()); - ASSERT_EQ(6, mock_server_->committed_ids().size()); + EXPECT_TRUE(6 == session.unsynced_count()); + ASSERT_TRUE(6 == mock_server_->committed_ids().size()); // This test will NOT unroll deletes because SERVER_PARENT_ID is not set. // It will treat these like moves. vector<syncable::Id> commit_ids(mock_server_->committed_ids()); - EXPECT_EQ(ids_.FromNumber(100), commit_ids[0]); - EXPECT_EQ(ids_.FromNumber(101), commit_ids[1]); - EXPECT_EQ(ids_.FromNumber(102), commit_ids[2]); + EXPECT_TRUE(ids_.FromNumber(100) == commit_ids[0]); + EXPECT_TRUE(ids_.FromNumber(101) == commit_ids[1]); + EXPECT_TRUE(ids_.FromNumber(102) == commit_ids[2]); // We don't guarantee the delete orders in this test, only that they occur // at the end. std::sort(commit_ids.begin() + 3, commit_ids.end()); - EXPECT_EQ(ids_.FromNumber(103), commit_ids[3]); - EXPECT_EQ(ids_.FromNumber(104), commit_ids[4]); - EXPECT_EQ(ids_.FromNumber(105), commit_ids[5]); + EXPECT_TRUE(ids_.FromNumber(103) == commit_ids[3]); + EXPECT_TRUE(ids_.FromNumber(104) == commit_ids[4]); + EXPECT_TRUE(ids_.FromNumber(105) == commit_ids[5]); } TEST_F(SyncerTest, TestCommitListOrderingWithNewItems) { @@ -766,15 +766,15 @@ TEST_F(SyncerTest, TestCommitListOrderingWithNewItems) { SyncCycleState cycle_state; SyncerSession session(&cycle_state, state_.get()); syncer_->SyncShare(&session); - EXPECT_EQ(6, session.unsynced_count()); - ASSERT_EQ(6, mock_server_->committed_ids().size()); + EXPECT_TRUE(6 == session.unsynced_count()); + ASSERT_TRUE(6 == mock_server_->committed_ids().size()); // If this test starts failing, be aware other sort orders could be valid. - EXPECT_EQ(parent_id_, mock_server_->committed_ids()[0]); - EXPECT_EQ(child_id_, mock_server_->committed_ids()[1]); - EXPECT_EQ(ids_.FromNumber(102), mock_server_->committed_ids()[2]); - EXPECT_EQ(ids_.FromNumber(-103), mock_server_->committed_ids()[3]); - EXPECT_EQ(ids_.FromNumber(-104), mock_server_->committed_ids()[4]); - EXPECT_EQ(ids_.FromNumber(105), mock_server_->committed_ids()[5]); + EXPECT_TRUE(parent_id_ == mock_server_->committed_ids()[0]); + EXPECT_TRUE(child_id_ == mock_server_->committed_ids()[1]); + EXPECT_TRUE(ids_.FromNumber(102) == mock_server_->committed_ids()[2]); + EXPECT_TRUE(ids_.FromNumber(-103) == mock_server_->committed_ids()[3]); + EXPECT_TRUE(ids_.FromNumber(-104) == mock_server_->committed_ids()[4]); + EXPECT_TRUE(ids_.FromNumber(105) == mock_server_->committed_ids()[5]); } TEST_F(SyncerTest, TestCommitListOrderingCounterexample) { @@ -806,12 +806,12 @@ TEST_F(SyncerTest, TestCommitListOrderingCounterexample) { SyncCycleState cycle_state; SyncerSession session(&cycle_state, state_.get()); syncer_->SyncShare(&session); - EXPECT_EQ(3, session.unsynced_count()); - ASSERT_EQ(3, mock_server_->committed_ids().size()); + EXPECT_TRUE(3 == session.unsynced_count()); + ASSERT_TRUE(3 == mock_server_->committed_ids().size()); // If this test starts failing, be aware other sort orders could be valid. - EXPECT_EQ(parent_id_, mock_server_->committed_ids()[0]); - EXPECT_EQ(child_id_, mock_server_->committed_ids()[1]); - EXPECT_EQ(child2_id, mock_server_->committed_ids()[2]); + EXPECT_TRUE(parent_id_ == mock_server_->committed_ids()[0]); + EXPECT_TRUE(child_id_ == mock_server_->committed_ids()[1]); + EXPECT_TRUE(child2_id == mock_server_->committed_ids()[2]); } TEST_F(SyncerTest, TestCommitListOrderingAndNewParent) { @@ -848,12 +848,12 @@ TEST_F(SyncerTest, TestCommitListOrderingAndNewParent) { SyncerSession session(&cycle_state, state_.get()); syncer_->SyncShare(&session); - EXPECT_EQ(3, session.unsynced_count()); - ASSERT_EQ(3, mock_server_->committed_ids().size()); + EXPECT_TRUE(3 == session.unsynced_count()); + ASSERT_TRUE(3 == mock_server_->committed_ids().size()); // If this test starts failing, be aware other sort orders could be valid. - EXPECT_EQ(parent_id_, mock_server_->committed_ids()[0]); - EXPECT_EQ(parent2_id, mock_server_->committed_ids()[1]); - EXPECT_EQ(child2_id, mock_server_->committed_ids()[2]); + EXPECT_TRUE(parent_id_ == mock_server_->committed_ids()[0]); + EXPECT_TRUE(parent2_id == mock_server_->committed_ids()[1]); + EXPECT_TRUE(child2_id == mock_server_->committed_ids()[2]); { ReadTransaction rtrans(dir, __FILE__, __LINE__); PathChar path[] = { '1', *kPathSeparator, 'A', 0}; @@ -901,12 +901,12 @@ TEST_F(SyncerTest, TestCommitListOrderingAndNewParentAndChild) { SyncerSession session(&cycle_state, state_.get()); syncer_->SyncShare(&session); - EXPECT_EQ(3, session.unsynced_count()); - ASSERT_EQ(3, mock_server_->committed_ids().size()); + EXPECT_TRUE(3 == session.unsynced_count()); + ASSERT_TRUE(3 == mock_server_->committed_ids().size()); // If this test starts failing, be aware other sort orders could be valid. - EXPECT_EQ(parent_id_, mock_server_->committed_ids()[0]); - EXPECT_EQ(ids_.FromNumber(-101), mock_server_->committed_ids()[1]); - EXPECT_EQ(ids_.FromNumber(-102), mock_server_->committed_ids()[2]); + EXPECT_TRUE(parent_id_ == mock_server_->committed_ids()[0]); + EXPECT_TRUE(ids_.FromNumber(-101) == mock_server_->committed_ids()[1]); + EXPECT_TRUE(ids_.FromNumber(-102) == mock_server_->committed_ids()[2]); { ReadTransaction rtrans(dir, __FILE__, __LINE__); PathChar path[] = { '1', *kPathSeparator, 'A', 0}; @@ -916,7 +916,7 @@ TEST_F(SyncerTest, TestCommitListOrderingAndNewParentAndChild) { ids_.FromNumber(-101)); ASSERT_FALSE(entry_id_minus_101.good()); Entry entry_b(&rtrans, syncable::GET_BY_HANDLE, meta_handle_b); - EXPECT_EQ(entry_1A.Get(syncable::ID), entry_b.Get(syncable::PARENT_ID)); + EXPECT_TRUE(entry_1A.Get(syncable::ID) == entry_b.Get(syncable::PARENT_ID)); EXPECT_TRUE(entry_1A.Get(syncable::ID).ServerKnows()); } } @@ -964,8 +964,8 @@ TEST_F(SyncerTest, NameSanitizationWithClientRename) { ASSERT_TRUE(mock_server_->commit_messages().rend() != it); const sync_pb::SyncEntity *const *s = (*it)->entries().data(); int s_len = (*it)->entries_size(); - ASSERT_EQ(1, s_len); - ASSERT_EQ("printer", (*s)[0].name()); + ASSERT_TRUE(1 == s_len); + ASSERT_TRUE("printer" == (*s)[0].name()); } } @@ -1028,13 +1028,13 @@ TEST_F(SyncerTest, MergeFolderWithSanitizedNameMatches) { ReadTransaction trans(dir, __FILE__, __LINE__); Directory::ChildHandles children; dir->GetChildHandles(&trans, trans.root_id(), &children); - EXPECT_EQ(1, children.size()); + EXPECT_TRUE(1 == children.size()); Directory::UnappliedUpdateMetaHandles unapplied; dir->GetUnappliedUpdateMetaHandles(&trans, &unapplied); - EXPECT_EQ(0, unapplied.size()); + EXPECT_TRUE(0 == unapplied.size()); syncable::Directory::UnsyncedMetaHandles unsynced; dir->GetUnsyncedMetaHandles(&trans, &unsynced); - EXPECT_EQ(0, unsynced.size()); + EXPECT_TRUE(0 == unsynced.size()); syncer_events_.clear(); } } @@ -1074,13 +1074,13 @@ TEST_F(SyncerTest, MergeFolderWithSanitizedNameThatDiffersOnlyByCase) { ReadTransaction trans(dir, __FILE__, __LINE__); Directory::ChildHandles children; dir->GetChildHandles(&trans, trans.root_id(), &children); - EXPECT_EQ(1, children.size()); + EXPECT_TRUE(1 == children.size()); Directory::UnappliedUpdateMetaHandles unapplied; dir->GetUnappliedUpdateMetaHandles(&trans, &unapplied); - EXPECT_EQ(0, unapplied.size()); + EXPECT_TRUE(0 == unapplied.size()); syncable::Directory::UnsyncedMetaHandles unsynced; dir->GetUnsyncedMetaHandles(&trans, &unsynced); - EXPECT_EQ(0, unsynced.size()); + EXPECT_TRUE(0 == unsynced.size()); syncer_events_.clear(); } } @@ -1114,8 +1114,8 @@ TEST_F(SyncerTest, NameSanitizationWithClientRename) { ASSERT_TRUE(mock_server_->commit_messages().rend() != it); const sync_pb::SyncEntity *const *s = (*it)->entries().data(); int s_len = (*it)->entries_size(); - ASSERT_EQ(1, s_len); - ASSERT_EQ("ab", (*s)[0].name()); + ASSERT_TRUE(1 == s_len); + ASSERT_TRUE("ab" == (*s)[0].name()); } } #endif @@ -1135,12 +1135,12 @@ void VerifyExistsWithNameInRoot(syncable::Directory* dir, TEST_F(SyncerTest, ExtendedAttributeWithNullCharacter) { ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); ASSERT_TRUE(dir.good()); - int xattr_count = 2; + size_t xattr_count = 2; PathString xattr_keys[] = { PSTR("key"), PSTR("key2") }; syncable::Blob xattr_values[2]; - char* value[] = { "value", "val\0ue" }; + const char* value[] = { "value", "val\0ue" }; int value_length[] = { 5, 6 }; - for (int i = 0; i < xattr_count; i++) { + for (size_t i = 0; i < xattr_count; i++) { for (int j = 0; j < value_length[i]; j++) xattr_values[i].push_back(value[i][j]); } @@ -1157,17 +1157,17 @@ TEST_F(SyncerTest, ExtendedAttributeWithNullCharacter) { ReadTransaction trans(dir, __FILE__, __LINE__); Entry entry1(&trans, syncable::GET_BY_ID, ids_.FromNumber(1)); ASSERT_TRUE(entry1.good()); - EXPECT_EQ(1, entry1.Get(syncable::BASE_VERSION)); - EXPECT_EQ(1, entry1.Get(syncable::SERVER_VERSION)); + EXPECT_TRUE(1 == entry1.Get(syncable::BASE_VERSION)); + EXPECT_TRUE(1 == entry1.Get(syncable::SERVER_VERSION)); set<ExtendedAttribute> client_extended_attributes; entry1.GetAllExtendedAttributes(&trans, &client_extended_attributes); - EXPECT_EQ(xattr_count, client_extended_attributes.size()); - for (int i = 0; i < xattr_count; i++) { + EXPECT_TRUE(xattr_count == client_extended_attributes.size()); + for (size_t i = 0; i < xattr_count; i++) { ExtendedAttributeKey key(entry1.Get(syncable::META_HANDLE), xattr_keys[i]); ExtendedAttribute expected_xattr(&trans, syncable::GET_BY_HANDLE, key); EXPECT_TRUE(expected_xattr.good()); for (int j = 0; j < value_length[i]; ++j) { - EXPECT_EQ(xattr_values[i][j], + EXPECT_TRUE(xattr_values[i][j] == static_cast<char>(expected_xattr.value().at(j))); } } @@ -1189,15 +1189,15 @@ TEST_F(SyncerTest, TestBasicUpdate) { syncer_->SyncShare(state_.get()); SyncerStatus status(NULL, state_.get()); - EXPECT_EQ(0, status.stalled_updates()); + EXPECT_TRUE(0 == status.stalled_updates()); { WriteTransaction trans(dir, UNITTEST, __FILE__, __LINE__); Entry entry(&trans, GET_BY_ID, syncable::Id::CreateFromServerId("some_id")); ASSERT_TRUE(entry.good()); EXPECT_TRUE(entry.Get(IS_DIR)); - EXPECT_EQ(entry.Get(SERVER_VERSION), version); - EXPECT_EQ(entry.Get(BASE_VERSION), version); + EXPECT_TRUE(entry.Get(SERVER_VERSION) == version); + EXPECT_TRUE(entry.Get(BASE_VERSION) == version); EXPECT_FALSE(entry.Get(IS_UNAPPLIED_UPDATE)); EXPECT_FALSE(entry.Get(IS_UNSYNCED)); EXPECT_FALSE(entry.Get(SERVER_IS_DEL)); @@ -1227,8 +1227,8 @@ TEST_F(SyncerTest, IllegalAndLegalUpdates) { ConflictResolutionView conflict_view(state_.get()); SyncerStatus status(NULL, state_.get()); // Ids 2 and 3 are expected to be in conflict now. - EXPECT_EQ(2, conflict_view.conflicting_updates()); - EXPECT_EQ(0, status.stalled_updates()); + EXPECT_TRUE(2 == conflict_view.conflicting_updates()); + EXPECT_TRUE(0 == status.stalled_updates()); // These entries will be used in the second set of updates. mock_server_->AddUpdateDirectory(4, 0, "newer_version", 20, 10); @@ -1241,8 +1241,8 @@ TEST_F(SyncerTest, IllegalAndLegalUpdates) { syncer_->SyncShare(state_.get()); // The three items with an unresolved parent should be unapplied (3, 9, 100). // The name clash should also still be in conflict. - EXPECT_EQ(4, conflict_view.conflicting_updates()); - EXPECT_EQ(0, status.stalled_updates()); + EXPECT_TRUE(4 == conflict_view.conflicting_updates()); + EXPECT_TRUE(0 == status.stalled_updates()); { WriteTransaction trans(dir, UNITTEST, __FILE__, __LINE__); Entry name_clash(&trans, GET_BY_ID, ids_.FromNumber(2)); @@ -1283,46 +1283,47 @@ TEST_F(SyncerTest, IllegalAndLegalUpdates) { Entry still_a_dir(&trans, GET_BY_ID, ids_.FromNumber(10)); ASSERT_TRUE(still_a_dir.good()); EXPECT_FALSE(still_a_dir.Get(IS_UNAPPLIED_UPDATE)); - EXPECT_EQ(10, still_a_dir.Get(BASE_VERSION)); - EXPECT_EQ(10, still_a_dir.Get(SERVER_VERSION)); + EXPECT_TRUE(10 == still_a_dir.Get(BASE_VERSION)); + EXPECT_TRUE(10 == still_a_dir.Get(SERVER_VERSION)); EXPECT_TRUE(still_a_dir.Get(IS_DIR)); Entry rename(&trans, GET_BY_PARENTID_AND_NAME, root, PSTR("new_name")); ASSERT_TRUE(rename.good()); EXPECT_FALSE(rename.Get(IS_UNAPPLIED_UPDATE)); - EXPECT_EQ(ids_.FromNumber(1), rename.Get(ID)); - EXPECT_EQ(20, rename.Get(BASE_VERSION)); + EXPECT_TRUE(ids_.FromNumber(1) == rename.Get(ID)); + EXPECT_TRUE(20 == rename.Get(BASE_VERSION)); Entry unblocked(&trans, GET_BY_PARENTID_AND_NAME, root, PSTR("in_root")); ASSERT_TRUE(unblocked.good()); EXPECT_FALSE(unblocked.Get(IS_UNAPPLIED_UPDATE)); - EXPECT_EQ(ids_.FromNumber(2), unblocked.Get(ID)); - EXPECT_EQ(10, unblocked.Get(BASE_VERSION)); + EXPECT_TRUE(ids_.FromNumber(2) == unblocked.Get(ID)); + EXPECT_TRUE(10 == unblocked.Get(BASE_VERSION)); Entry ignored_old_version(&trans, GET_BY_ID, ids_.FromNumber(4)); ASSERT_TRUE(ignored_old_version.good()); - EXPECT_EQ(ignored_old_version.Get(NAME), PSTR("newer_version")); + EXPECT_TRUE(ignored_old_version.Get(NAME) == PSTR("newer_version")); EXPECT_FALSE(ignored_old_version.Get(IS_UNAPPLIED_UPDATE)); - EXPECT_EQ(20, ignored_old_version.Get(BASE_VERSION)); + EXPECT_TRUE(20 == ignored_old_version.Get(BASE_VERSION)); Entry circular_parent_issue(&trans, GET_BY_ID, ids_.FromNumber(5)); ASSERT_TRUE(circular_parent_issue.good()); EXPECT_TRUE(circular_parent_issue.Get(IS_UNAPPLIED_UPDATE)) << "circular move should be in conflict"; - EXPECT_EQ(circular_parent_issue.Get(PARENT_ID), root_id_); - EXPECT_EQ(circular_parent_issue.Get(SERVER_PARENT_ID), ids_.FromNumber(6)); - EXPECT_EQ(10, circular_parent_issue.Get(BASE_VERSION)); + EXPECT_TRUE(circular_parent_issue.Get(PARENT_ID) == root_id_); + EXPECT_TRUE(circular_parent_issue.Get(SERVER_PARENT_ID) == + ids_.FromNumber(6)); + EXPECT_TRUE(10 == circular_parent_issue.Get(BASE_VERSION)); Entry circular_parent_target(&trans, GET_BY_ID, ids_.FromNumber(6)); ASSERT_TRUE(circular_parent_target.good()); EXPECT_FALSE(circular_parent_target.Get(IS_UNAPPLIED_UPDATE)); - EXPECT_EQ(circular_parent_issue.Get(ID), + EXPECT_TRUE(circular_parent_issue.Get(ID) == circular_parent_target.Get(PARENT_ID)); - EXPECT_EQ(10, circular_parent_target.Get(BASE_VERSION)); + EXPECT_TRUE(10 == circular_parent_target.Get(BASE_VERSION)); } - EXPECT_EQ(0, syncer_events_.size()); - EXPECT_EQ(4, conflict_view.conflicting_updates()); + EXPECT_TRUE(0 == syncer_events_.size()); + EXPECT_TRUE(4 == conflict_view.conflicting_updates()); } TEST_F(SyncerTest, CommitTimeRename) { @@ -1442,7 +1443,7 @@ TEST_F(SyncerTest, CommitTimeRenameCollision) { ReadTransaction trans(dir, __FILE__, __LINE__); Entry collider_folder(&trans, GET_BY_PARENTID_AND_NAME, root_id_, PSTR("renamed_Folder")); - EXPECT_EQ(collider_folder.Get(UNSANITIZED_NAME), PSTR("")); + EXPECT_TRUE(collider_folder.Get(UNSANITIZED_NAME) == PSTR("")); ASSERT_TRUE(collider_folder.good()); // ID is generated by next_new_id_ and server mock prepending of strings. @@ -1450,8 +1451,8 @@ TEST_F(SyncerTest, CommitTimeRenameCollision) { syncable::Id::CreateFromServerId("mock_server:30000")); ASSERT_TRUE(entry_folder.good()); // A little arbitrary but nothing we can do about that. - EXPECT_EQ(entry_folder.Get(NAME), PSTR("renamed_Folder~1")); - EXPECT_EQ(entry_folder.Get(UNSANITIZED_NAME), PSTR("renamed_Folder")); + EXPECT_TRUE(entry_folder.Get(NAME) == PSTR("renamed_Folder~1")); + EXPECT_TRUE(entry_folder.Get(UNSANITIZED_NAME) == PSTR("renamed_Folder")); } } @@ -1503,7 +1504,6 @@ TEST_F(SyncerTest, CommitReuniteUpdateAdjustsChildren) { // Now, to emulate a commit response failure, we just don't commit it. int64 new_version = 150; // any larger value. int64 timestamp = 20; // arbitrary value. - int64 size = 20; // arbitrary. syncable::Id new_folder_id = syncable::Id::CreateFromServerId("folder_server_id"); @@ -1524,8 +1524,8 @@ TEST_F(SyncerTest, CommitReuniteUpdateAdjustsChildren) { ReadTransaction trans(dir, __FILE__, __LINE__); Entry folder(&trans, GET_BY_PATH, PSTR("new_folder")); ASSERT_TRUE(folder.good()); - EXPECT_EQ(new_version, folder.Get(BASE_VERSION)); - EXPECT_EQ(new_folder_id, folder.Get(ID)); + EXPECT_TRUE(new_version == folder.Get(BASE_VERSION)); + EXPECT_TRUE(new_folder_id == folder.Get(ID)); EXPECT_TRUE(folder.Get(ID).ServerKnows()); // We changed the id of the parent, old lookups should fail. @@ -1585,8 +1585,8 @@ TEST_F(SyncerTest, CommitReuniteUpdate) { ReadTransaction trans(dir, __FILE__, __LINE__); Entry entry(&trans, GET_BY_PATH, PSTR("new_entry")); ASSERT_TRUE(entry.good()); - EXPECT_EQ(new_version, entry.Get(BASE_VERSION)); - EXPECT_EQ(new_entry_id, entry.Get(ID)); + EXPECT_TRUE(new_version == entry.Get(BASE_VERSION)); + EXPECT_TRUE(new_entry_id == entry.Get(ID)); } } @@ -1619,7 +1619,6 @@ TEST_F(SyncerTest, CommitReuniteUpdateDoesNotChokeOnDeletedLocalEntry) { // Now, to emulate a commit response failure, we just don't commit it. int64 new_version = 150; // any larger value. int64 timestamp = 20; // arbitrary value. - int64 size = 20; // arbitrary. syncable::Id new_entry_id = syncable::Id::CreateFromServerId("server_id"); // Generate an update from the server with a relevant ID reassignment. @@ -1685,15 +1684,15 @@ TEST_F(SyncerTest, ConflictMatchingEntryHandlesUnsanitizedNames) { Entry A(&trans, GET_BY_ID, ids_.FromNumber(1)); ASSERT_TRUE(A.good()); - EXPECT_EQ(A.Get(IS_UNSYNCED), false); - EXPECT_EQ(A.Get(IS_UNAPPLIED_UPDATE), false); - EXPECT_EQ(A.Get(SERVER_VERSION), 20); + EXPECT_TRUE(A.Get(IS_UNSYNCED) == false); + EXPECT_TRUE(A.Get(IS_UNAPPLIED_UPDATE) == false); + EXPECT_TRUE(A.Get(SERVER_VERSION) == 20); Entry B(&trans, GET_BY_ID, ids_.FromNumber(2)); ASSERT_TRUE(B.good()); - EXPECT_EQ(B.Get(IS_UNSYNCED), false); - EXPECT_EQ(B.Get(IS_UNAPPLIED_UPDATE), false); - EXPECT_EQ(B.Get(SERVER_VERSION), 20); + EXPECT_TRUE(B.Get(IS_UNSYNCED) == false); + EXPECT_TRUE(B.Get(IS_UNAPPLIED_UPDATE) == false); + EXPECT_TRUE(B.Get(SERVER_VERSION) == 20); } } @@ -1727,15 +1726,15 @@ TEST_F(SyncerTest, ConflictMatchingEntryHandlesNormalNames) { Entry A(&trans, GET_BY_ID, ids_.FromNumber(1)); ASSERT_TRUE(A.good()); - EXPECT_EQ(A.Get(IS_UNSYNCED), false); - EXPECT_EQ(A.Get(IS_UNAPPLIED_UPDATE), false); - EXPECT_EQ(A.Get(SERVER_VERSION), 20); + EXPECT_TRUE(A.Get(IS_UNSYNCED) == false); + EXPECT_TRUE(A.Get(IS_UNAPPLIED_UPDATE) == false); + EXPECT_TRUE(A.Get(SERVER_VERSION) == 20); Entry B(&trans, GET_BY_ID, ids_.FromNumber(2)); ASSERT_TRUE(B.good()); - EXPECT_EQ(B.Get(IS_UNSYNCED), false); - EXPECT_EQ(B.Get(IS_UNAPPLIED_UPDATE), false); - EXPECT_EQ(B.Get(SERVER_VERSION), 20); + EXPECT_TRUE(B.Get(IS_UNSYNCED) == false); + EXPECT_TRUE(B.Get(IS_UNAPPLIED_UPDATE) == false); + EXPECT_TRUE(B.Get(SERVER_VERSION) == 20); } } @@ -1778,7 +1777,7 @@ TEST_F(SyncerTest, EntryCreatedInNewFolderMidSync) { } mock_server_->SetMidCommitCallbackFunction(CreateFolderInBob); syncer_->SyncShare(BUILD_COMMIT_REQUEST, SYNCER_END); - EXPECT_EQ(1, mock_server_->committed_ids().size()); + EXPECT_TRUE(1 == mock_server_->committed_ids().size()); { ReadTransaction trans(dir, __FILE__, __LINE__); PathChar path[] = {*kPathSeparator, 'b', 'o', 'b', 0}; @@ -1828,7 +1827,7 @@ TEST_F(SyncerTest, UnappliedUpdateOnCreatedItemItemDoesNotCrash) { } // Commit it. syncer_->SyncShare(); - EXPECT_EQ(1, mock_server_->committed_ids().size()); + EXPECT_TRUE(1 == mock_server_->committed_ids().size()); mock_server_->set_conflict_all_commits(true); syncable::Id fred_match_id; { @@ -1854,7 +1853,7 @@ TEST_F(SyncerTest, NameClashWithResolverInconsistentUpdates) { CHECK(dir.good()); const char* base_name = "name_clash_with_resolver"; const char* full_name = "name_clash_with_resolver.htm"; - PathChar* base_name_p = PSTR("name_clash_with_resolver"); + const PathChar* base_name_p = PSTR("name_clash_with_resolver"); mock_server_->AddUpdateBookmark(1, 0, full_name, 10, 10); syncer_->SyncShare(); { @@ -1868,21 +1867,21 @@ TEST_F(SyncerTest, NameClashWithResolverInconsistentUpdates) { syncer_->SyncShare(); mock_server_->set_conflict_n_commits(1); syncer_->SyncShare(); - EXPECT_EQ(0, syncer_events_.size()); + EXPECT_TRUE(0 == syncer_events_.size()); { ReadTransaction trans(dir, __FILE__, __LINE__); Entry id1(&trans, GET_BY_ID, ids_.FromNumber(1)); Entry id2(&trans, GET_BY_ID, ids_.FromNumber(2)); ASSERT_TRUE(id1.good()); ASSERT_TRUE(id2.good()); - EXPECT_EQ(root_id_, id1.Get(PARENT_ID)); - EXPECT_EQ(root_id_, id2.Get(PARENT_ID)); + EXPECT_TRUE(root_id_ == id1.Get(PARENT_ID)); + EXPECT_TRUE(root_id_ == id2.Get(PARENT_ID)); PathString id1name = id1.Get(NAME); - EXPECT_EQ(base_name_p, id1name.substr(0, strlen(base_name))); - EXPECT_EQ(PSTR(".htm"), id1name.substr(id1name.length() - 4)); + EXPECT_TRUE(base_name_p == id1name.substr(0, strlen(base_name))); + EXPECT_TRUE(PSTR(".htm") == id1name.substr(id1name.length() - 4)); EXPECT_LE(id1name.length(), 200ul); - EXPECT_EQ(PSTR("name_clash_with_resolver.htm"), id2.Get(NAME)); + EXPECT_TRUE(PSTR("name_clash_with_resolver.htm") == id2.Get(NAME)); } } @@ -1891,8 +1890,8 @@ TEST_F(SyncerTest, NameClashWithResolver) { CHECK(dir.good()); const char* base_name = "name_clash_with_resolver"; const char* full_name = "name_clash_with_resolver.htm"; - PathChar* base_name_p = PSTR("name_clash_with_resolver"); - PathChar* full_name_p = PSTR("name_clash_with_resolver.htm"); + const PathChar* base_name_p = PSTR("name_clash_with_resolver"); + const PathChar* full_name_p = PSTR("name_clash_with_resolver.htm"); mock_server_->AddUpdateBookmark(1, 0, "fred", 10, 10); syncer_->SyncShare(); { @@ -1911,7 +1910,7 @@ TEST_F(SyncerTest, NameClashWithResolver) { syncer_->SyncShare(state_.get()); mock_server_->set_conflict_n_commits(1); syncer_->SyncShare(state_.get()); - EXPECT_EQ(0, syncer_events_.size()); + EXPECT_TRUE(0 == syncer_events_.size()); syncer_events_.clear(); { ReadTransaction trans(dir, __FILE__, __LINE__); @@ -1919,14 +1918,14 @@ TEST_F(SyncerTest, NameClashWithResolver) { Entry id2(&trans, GET_BY_ID, ids_.FromNumber(2)); ASSERT_TRUE(id1.good()); ASSERT_TRUE(id2.good()); - EXPECT_EQ(root_id_, id1.Get(PARENT_ID)); - EXPECT_EQ(root_id_, id2.Get(PARENT_ID)); + EXPECT_TRUE(root_id_ == id1.Get(PARENT_ID)); + EXPECT_TRUE(root_id_ == id2.Get(PARENT_ID)); PathString id1name = id1.Get(NAME); - EXPECT_EQ(base_name_p, id1name.substr(0, strlen(base_name))); - EXPECT_EQ(PSTR(".htm"), id1name.substr(id1name.length() - 4)); + EXPECT_TRUE(base_name_p == id1name.substr(0, strlen(base_name))); + EXPECT_TRUE(PSTR(".htm") == id1name.substr(id1name.length() - 4)); EXPECT_LE(id1name.length(), 200ul); - EXPECT_EQ(full_name_p, id2.Get(NAME)); + EXPECT_TRUE(full_name_p == id2.Get(NAME)); } } @@ -1957,18 +1956,18 @@ TEST_F(SyncerTest, VeryLongNameClashWithResolver) { syncer_->SyncShare(state_.get()); mock_server_->set_conflict_n_commits(1); syncer_->SyncShare(state_.get()); - EXPECT_EQ(0, syncer_events_.size()); + EXPECT_TRUE(0 == syncer_events_.size()); { ReadTransaction trans(dir, __FILE__, __LINE__); Entry id1(&trans, GET_BY_ID, ids_.FromNumber(1)); Entry id2(&trans, GET_BY_ID, ids_.FromNumber(2)); ASSERT_TRUE(id1.good()); ASSERT_TRUE(id2.good()); - EXPECT_EQ(root_id_, id1.Get(PARENT_ID)); - EXPECT_EQ(root_id_, id2.Get(PARENT_ID)); + EXPECT_TRUE(root_id_ == id1.Get(PARENT_ID)); + EXPECT_TRUE(root_id_ == id2.Get(PARENT_ID)); PathString id1name = id1.Get(NAME); - EXPECT_EQ(PSTR(".htm"), id1name.substr(id1name.length() - 4)); - EXPECT_EQ(name_w, id2.Get(NAME)); + EXPECT_TRUE(PSTR(".htm") == id1name.substr(id1name.length() - 4)); + EXPECT_TRUE(name_w == id2.Get(NAME)); } } @@ -1989,18 +1988,18 @@ TEST_F(SyncerTest, NameClashWithResolverAndDotStartedName) { mock_server_->AddUpdateBookmark(2, 0, ".htm", 10, 10); syncer_->SyncShare(); syncer_->SyncShare(); - EXPECT_EQ(0, syncer_events_.size()); + EXPECT_TRUE(0 == syncer_events_.size()); { ReadTransaction trans(dir, __FILE__, __LINE__); Entry id1(&trans, GET_BY_ID, ids_.FromNumber(1)); Entry id2(&trans, GET_BY_ID, ids_.FromNumber(2)); ASSERT_TRUE(id1.good()); ASSERT_TRUE(id2.good()); - EXPECT_EQ(root_id_, id1.Get(PARENT_ID)); - EXPECT_EQ(root_id_, id2.Get(PARENT_ID)); + EXPECT_TRUE(root_id_ == id1.Get(PARENT_ID)); + EXPECT_TRUE(root_id_ == id2.Get(PARENT_ID)); PathString id1name = id1.Get(NAME); - EXPECT_EQ(PSTR(".htm"), id1name.substr(0, 4)); - EXPECT_EQ(PSTR(".htm"), id2.Get(NAME)); + EXPECT_TRUE(PSTR(".htm") == id1name.substr(0, 4)); + EXPECT_TRUE(PSTR(".htm") == id2.Get(NAME)); } } @@ -2040,7 +2039,7 @@ TEST_F(SyncerTest, ThreeNamesClashWithResolver) { mock_server_->AddUpdateBookmark(4, 0, "in_root.htm", 10, 10); LoopSyncShare(syncer_); LoopSyncShare(syncer_); - EXPECT_EQ(0, syncer_events_.size()); + EXPECT_TRUE(0 == syncer_events_.size()); { ReadTransaction trans(dir, __FILE__, __LINE__); Entry id1(&trans, GET_BY_ID, ids_.FromNumber(1)); @@ -2051,26 +2050,26 @@ TEST_F(SyncerTest, ThreeNamesClashWithResolver) { ASSERT_TRUE(id2.good()); ASSERT_TRUE(id3.good()); ASSERT_TRUE(id4.good()); - EXPECT_EQ(root_id_, id1.Get(PARENT_ID)); - EXPECT_EQ(root_id_, id2.Get(PARENT_ID)); - EXPECT_EQ(root_id_, id3.Get(PARENT_ID)); - EXPECT_EQ(root_id_, id4.Get(PARENT_ID)); + EXPECT_TRUE(root_id_ == id1.Get(PARENT_ID)); + EXPECT_TRUE(root_id_ == id2.Get(PARENT_ID)); + EXPECT_TRUE(root_id_ == id3.Get(PARENT_ID)); + EXPECT_TRUE(root_id_ == id4.Get(PARENT_ID)); PathString id1name = id1.Get(NAME); ASSERT_GE(id1name.length(), 4ul); - EXPECT_EQ(PSTR("in_root"), id1name.substr(0, 7)); - EXPECT_EQ(PSTR(".htm"), id1name.substr(id1name.length() - 4)); + EXPECT_TRUE(PSTR("in_root") == id1name.substr(0, 7)); + EXPECT_TRUE(PSTR(".htm") == id1name.substr(id1name.length() - 4)); EXPECT_NE(PSTR("in_root.htm"), id1.Get(NAME)); PathString id2name = id2.Get(NAME); ASSERT_GE(id2name.length(), 4ul); - EXPECT_EQ(PSTR("in_root"), id2name.substr(0, 7)); - EXPECT_EQ(PSTR(".htm"), id2name.substr(id2name.length() - 4)); + EXPECT_TRUE(PSTR("in_root") == id2name.substr(0, 7)); + EXPECT_TRUE(PSTR(".htm") == id2name.substr(id2name.length() - 4)); EXPECT_NE(PSTR("in_root.htm"), id2.Get(NAME)); PathString id3name = id3.Get(NAME); ASSERT_GE(id3name.length(), 4ul); - EXPECT_EQ(PSTR("in_root"), id3name.substr(0, 7)); - EXPECT_EQ(PSTR(".htm"), id3name.substr(id3name.length() - 4)); + EXPECT_TRUE(PSTR("in_root") == id3name.substr(0, 7)); + EXPECT_TRUE(PSTR(".htm") == id3name.substr(id3name.length() - 4)); EXPECT_NE(PSTR("in_root.htm"), id3.Get(NAME)); - EXPECT_EQ(PSTR("in_root.htm"), id4.Get(NAME)); + EXPECT_TRUE(PSTR("in_root.htm") == id4.Get(NAME)); } } @@ -2110,7 +2109,7 @@ TEST_F(SyncerTest, DoublyChangedWithResolver) { } // Only one entry, since we just overwrite one. - EXPECT_EQ(1, children.size()); + EXPECT_TRUE(1 == children.size()); syncer_events_.clear(); } @@ -2150,7 +2149,7 @@ TEST_F(SyncerTest, CommitsUpdateDoesntAlterEntry) { ReadTransaction trans(dir, __FILE__, __LINE__); Entry entry(&trans, syncable::GET_BY_ID, id); ASSERT_TRUE(entry.good()); - EXPECT_EQ(entry.Get(MTIME), test_time); + EXPECT_TRUE(entry.Get(MTIME) == test_time); } } @@ -2177,15 +2176,15 @@ TEST_F(SyncerTest, ParentAndChildBothMatch) { ReadTransaction trans(dir, __FILE__, __LINE__); Directory::ChildHandles children; dir->GetChildHandles(&trans, root_id_, &children); - EXPECT_EQ(1, children.size()); + EXPECT_TRUE(1 == children.size()); dir->GetChildHandles(&trans, parent_id_, &children); - EXPECT_EQ(1, children.size()); + EXPECT_TRUE(1 == children.size()); Directory::UnappliedUpdateMetaHandles unapplied; dir->GetUnappliedUpdateMetaHandles(&trans, &unapplied); - EXPECT_EQ(0, unapplied.size()); + EXPECT_TRUE(0 == unapplied.size()); syncable::Directory::UnsyncedMetaHandles unsynced; dir->GetUnsyncedMetaHandles(&trans, &unsynced); - EXPECT_EQ(0, unsynced.size()); + EXPECT_TRUE(0 == unsynced.size()); syncer_events_.clear(); } } @@ -2200,7 +2199,7 @@ TEST_F(SyncerTest, CommittingNewDeleted) { entry.Put(IS_DEL, true); } syncer_->SyncShare(); - EXPECT_EQ(0, mock_server_->committed_ids().size()); + EXPECT_TRUE(0 == mock_server_->committed_ids().size()); } // Original problem synopsis: @@ -2230,7 +2229,7 @@ TEST_F(SyncerTest, UnappliedUpdateDuringCommit) { syncer_->SyncShare(state_.get()); syncer_->SyncShare(state_.get()); SyncerStatus status(NULL, state_.get()); - EXPECT_EQ(0, status.conflicting_updates()); + EXPECT_TRUE(0 == status.conflicting_updates()); syncer_events_.clear(); } @@ -2274,9 +2273,9 @@ TEST_F(SyncerTest, DeletingEntryInFolder) { } syncer_->SyncShare(state_.get()); SyncerStatus status(NULL, state_.get()); - EXPECT_EQ(0, status.error_commits()); - EXPECT_EQ(0, status.conflicting_commits()); - EXPECT_EQ(0, status.BlockedItemsSize()); + EXPECT_TRUE(0 == status.error_commits()); + EXPECT_TRUE(0 == status.conflicting_commits()); + EXPECT_TRUE(0 == status.BlockedItemsSize()); } // TODO(sync): Is this test useful anymore? @@ -2315,12 +2314,12 @@ TEST_F(SyncerTest, FolderSwapUpdate) { ReadTransaction trans(dir, __FILE__, __LINE__); Entry id1(&trans, GET_BY_ID, ids_.FromNumber(7801)); ASSERT_TRUE(id1.good()); - EXPECT_EQ(PSTR("fred"), id1.Get(NAME)); - EXPECT_EQ(root_id_, id1.Get(PARENT_ID)); + EXPECT_TRUE(PSTR("fred") == id1.Get(NAME)); + EXPECT_TRUE(root_id_ == id1.Get(PARENT_ID)); Entry id2(&trans, GET_BY_ID, ids_.FromNumber(1024)); ASSERT_TRUE(id2.good()); - EXPECT_EQ(PSTR("bob"), id2.Get(NAME)); - EXPECT_EQ(root_id_, id2.Get(PARENT_ID)); + EXPECT_TRUE(PSTR("bob") == id2.Get(NAME)); + EXPECT_TRUE(root_id_ == id2.Get(PARENT_ID)); } syncer_events_.clear(); } @@ -2336,16 +2335,16 @@ TEST_F(SyncerTest, CorruptUpdateBadFolderSwapUpdate) { ReadTransaction trans(dir, __FILE__, __LINE__); Entry id1(&trans, GET_BY_ID, ids_.FromNumber(7801)); ASSERT_TRUE(id1.good()); - EXPECT_EQ(PSTR("bob"), id1.Get(NAME)); - EXPECT_EQ(root_id_, id1.Get(PARENT_ID)); + EXPECT_TRUE(PSTR("bob") == id1.Get(NAME)); + EXPECT_TRUE(root_id_ == id1.Get(PARENT_ID)); Entry id2(&trans, GET_BY_ID, ids_.FromNumber(1024)); ASSERT_TRUE(id2.good()); - EXPECT_EQ(PSTR("fred"), id2.Get(NAME)); - EXPECT_EQ(root_id_, id2.Get(PARENT_ID)); + EXPECT_TRUE(PSTR("fred") == id2.Get(NAME)); + EXPECT_TRUE(root_id_ == id2.Get(PARENT_ID)); Entry id3(&trans, GET_BY_ID, ids_.FromNumber(4096)); ASSERT_TRUE(id3.good()); - EXPECT_EQ(PSTR("alice"), id3.Get(NAME)); - EXPECT_EQ(root_id_, id3.Get(PARENT_ID)); + EXPECT_TRUE(PSTR("alice") == id3.Get(NAME)); + EXPECT_TRUE(root_id_ == id3.Get(PARENT_ID)); } mock_server_->AddUpdateDirectory(1024, 0, "bob", 2, 20); mock_server_->AddUpdateDirectory(7801, 0, "fred", 2, 20); @@ -2355,16 +2354,16 @@ TEST_F(SyncerTest, CorruptUpdateBadFolderSwapUpdate) { ReadTransaction trans(dir, __FILE__, __LINE__); Entry id1(&trans, GET_BY_ID, ids_.FromNumber(7801)); ASSERT_TRUE(id1.good()); - EXPECT_EQ(PSTR("bob"), id1.Get(NAME)); - EXPECT_EQ(root_id_, id1.Get(PARENT_ID)); + EXPECT_TRUE(PSTR("bob") == id1.Get(NAME)); + EXPECT_TRUE(root_id_ == id1.Get(PARENT_ID)); Entry id2(&trans, GET_BY_ID, ids_.FromNumber(1024)); ASSERT_TRUE(id2.good()); - EXPECT_EQ(PSTR("fred"), id2.Get(NAME)); - EXPECT_EQ(root_id_, id2.Get(PARENT_ID)); + EXPECT_TRUE(PSTR("fred") == id2.Get(NAME)); + EXPECT_TRUE(root_id_ == id2.Get(PARENT_ID)); Entry id3(&trans, GET_BY_ID, ids_.FromNumber(4096)); ASSERT_TRUE(id3.good()); - EXPECT_EQ(PSTR("alice"), id3.Get(NAME)); - EXPECT_EQ(root_id_, id3.Get(PARENT_ID)); + EXPECT_TRUE(PSTR("alice") == id3.Get(NAME)); + EXPECT_TRUE(root_id_ == id3.Get(PARENT_ID)); } syncer_events_.clear(); } @@ -2392,20 +2391,18 @@ TEST_F(SyncerTest, DISABLED_FolderSwapCommit) { } mock_server_->set_conflict_all_commits(true); syncer_->SyncShare(); - ASSERT_EQ(2, mock_server_->commit_messages().size()); - CommitMessage* m0 = mock_server_->commit_messages()[0]; - CommitMessage* m1 = mock_server_->commit_messages()[1]; + ASSERT_TRUE(2 == mock_server_->commit_messages().size()); { ReadTransaction trans(dir, __FILE__, __LINE__); Entry id1(&trans, GET_BY_ID, ids_.FromNumber(7801)); ASSERT_TRUE(id1.good()); - EXPECT_EQ(PSTR("fred"), id1.Get(NAME)); - EXPECT_EQ(root_id_, id1.Get(PARENT_ID)); + EXPECT_TRUE(PSTR("fred") == id1.Get(NAME)); + EXPECT_TRUE(root_id_ == id1.Get(PARENT_ID)); EXPECT_FALSE(id1.Get(IS_UNSYNCED)); Entry id2(&trans, GET_BY_ID, ids_.FromNumber(1024)); ASSERT_TRUE(id2.good()); - EXPECT_EQ(PSTR("bob"), id2.Get(NAME)); - EXPECT_EQ(root_id_, id2.Get(PARENT_ID)); + EXPECT_TRUE(PSTR("bob") == id2.Get(NAME)); + EXPECT_TRUE(root_id_ == id2.Get(PARENT_ID)); EXPECT_FALSE(id2.Get(IS_UNSYNCED)); } syncer_events_.clear(); @@ -2446,32 +2443,28 @@ TEST_F(SyncerTest, DISABLED_DualFolderSwapCommit) { } mock_server_->set_conflict_all_commits(true); syncer_->SyncShare(); - ASSERT_EQ(4, mock_server_->commit_messages().size()); - CommitMessage* m0 = mock_server_->commit_messages()[0]; - CommitMessage* m1 = mock_server_->commit_messages()[1]; - CommitMessage* m2 = mock_server_->commit_messages()[2]; - CommitMessage* m3 = mock_server_->commit_messages()[3]; + ASSERT_TRUE(4 == mock_server_->commit_messages().size()); { ReadTransaction trans(dir, __FILE__, __LINE__); Entry id1(&trans, GET_BY_ID, ids_.FromNumber(1)); ASSERT_TRUE(id1.good()); - EXPECT_EQ(PSTR("fred"), id1.Get(NAME)); - EXPECT_EQ(root_id_, id1.Get(PARENT_ID)); + EXPECT_TRUE(PSTR("fred") == id1.Get(NAME)); + EXPECT_TRUE(root_id_ == id1.Get(PARENT_ID)); EXPECT_FALSE(id1.Get(IS_UNSYNCED)); Entry id2(&trans, GET_BY_ID, ids_.FromNumber(2)); ASSERT_TRUE(id2.good()); - EXPECT_EQ(PSTR("bob"), id2.Get(NAME)); - EXPECT_EQ(root_id_, id2.Get(PARENT_ID)); + EXPECT_TRUE(PSTR("bob") == id2.Get(NAME)); + EXPECT_TRUE(root_id_ == id2.Get(PARENT_ID)); EXPECT_FALSE(id2.Get(IS_UNSYNCED)); Entry id3(&trans, GET_BY_ID, ids_.FromNumber(3)); ASSERT_TRUE(id3.good()); - EXPECT_EQ(PSTR("greg"), id3.Get(NAME)); - EXPECT_EQ(root_id_, id3.Get(PARENT_ID)); + EXPECT_TRUE(PSTR("greg") == id3.Get(NAME)); + EXPECT_TRUE(root_id_ == id3.Get(PARENT_ID)); EXPECT_FALSE(id3.Get(IS_UNSYNCED)); Entry id4(&trans, GET_BY_ID, ids_.FromNumber(4)); ASSERT_TRUE(id4.good()); - EXPECT_EQ(PSTR("sue"), id4.Get(NAME)); - EXPECT_EQ(root_id_, id4.Get(PARENT_ID)); + EXPECT_TRUE(PSTR("sue") == id4.Get(NAME)); + EXPECT_TRUE(root_id_ == id4.Get(PARENT_ID)); EXPECT_FALSE(id4.Get(IS_UNSYNCED)); } syncer_events_.clear(); @@ -2505,25 +2498,23 @@ TEST_F(SyncerTest, DISABLED_TripleFolderRotateCommit) { } mock_server_->set_conflict_all_commits(true); syncer_->SyncShare(); - ASSERT_EQ(2, mock_server_->commit_messages().size()); - CommitMessage* m0 = mock_server_->commit_messages()[0]; - CommitMessage* m1 = mock_server_->commit_messages()[1]; + ASSERT_TRUE(2 == mock_server_->commit_messages().size()); { ReadTransaction trans(dir, __FILE__, __LINE__); Entry id1(&trans, GET_BY_ID, ids_.FromNumber(1)); ASSERT_TRUE(id1.good()); - EXPECT_EQ(PSTR("sue"), id1.Get(NAME)); - EXPECT_EQ(root_id_, id1.Get(PARENT_ID)); + EXPECT_TRUE(PSTR("sue") == id1.Get(NAME)); + EXPECT_TRUE(root_id_ == id1.Get(PARENT_ID)); EXPECT_FALSE(id1.Get(IS_UNSYNCED)); Entry id2(&trans, GET_BY_ID, ids_.FromNumber(2)); ASSERT_TRUE(id2.good()); - EXPECT_EQ(PSTR("bob"), id2.Get(NAME)); - EXPECT_EQ(root_id_, id2.Get(PARENT_ID)); + EXPECT_TRUE(PSTR("bob") == id2.Get(NAME)); + EXPECT_TRUE(root_id_ == id2.Get(PARENT_ID)); EXPECT_FALSE(id2.Get(IS_UNSYNCED)); Entry id3(&trans, GET_BY_ID, ids_.FromNumber(3)); ASSERT_TRUE(id3.good()); - EXPECT_EQ(PSTR("fred"), id3.Get(NAME)); - EXPECT_EQ(root_id_, id3.Get(PARENT_ID)); + EXPECT_TRUE(PSTR("fred") == id3.Get(NAME)); + EXPECT_TRUE(root_id_ == id3.Get(PARENT_ID)); EXPECT_FALSE(id3.Get(IS_UNSYNCED)); } syncer_events_.clear(); @@ -2556,30 +2547,28 @@ TEST_F(SyncerTest, DISABLED_ServerAndClientSwap) { mock_server_->AddUpdateDirectory(3, 0, "greg", 2, 20); mock_server_->AddUpdateDirectory(4, 0, "sue", 2, 20); syncer_->SyncShare(); - ASSERT_EQ(2, mock_server_->commit_messages().size()); - CommitMessage* m0 = mock_server_->commit_messages()[0]; - CommitMessage* m1 = mock_server_->commit_messages()[1]; + ASSERT_TRUE(2 == mock_server_->commit_messages().size()); { ReadTransaction trans(dir, __FILE__, __LINE__); Entry id1(&trans, GET_BY_ID, ids_.FromNumber(1)); ASSERT_TRUE(id1.good()); - EXPECT_EQ(PSTR("fred"), id1.Get(NAME)); - EXPECT_EQ(root_id_, id1.Get(PARENT_ID)); + EXPECT_TRUE(PSTR("fred") == id1.Get(NAME)); + EXPECT_TRUE(root_id_ == id1.Get(PARENT_ID)); EXPECT_FALSE(id1.Get(IS_UNSYNCED)); Entry id2(&trans, GET_BY_ID, ids_.FromNumber(2)); ASSERT_TRUE(id2.good()); - EXPECT_EQ(PSTR("bob"), id2.Get(NAME)); - EXPECT_EQ(root_id_, id2.Get(PARENT_ID)); + EXPECT_TRUE(PSTR("bob") == id2.Get(NAME)); + EXPECT_TRUE(root_id_ == id2.Get(PARENT_ID)); EXPECT_FALSE(id2.Get(IS_UNSYNCED)); Entry id3(&trans, GET_BY_ID, ids_.FromNumber(3)); ASSERT_TRUE(id3.good()); - EXPECT_EQ(PSTR("greg"), id3.Get(NAME)); - EXPECT_EQ(root_id_, id3.Get(PARENT_ID)); + EXPECT_TRUE(PSTR("greg") == id3.Get(NAME)); + EXPECT_TRUE(root_id_ == id3.Get(PARENT_ID)); EXPECT_FALSE(id3.Get(IS_UNSYNCED)); Entry id4(&trans, GET_BY_ID, ids_.FromNumber(4)); ASSERT_TRUE(id4.good()); - EXPECT_EQ(PSTR("sue"), id4.Get(NAME)); - EXPECT_EQ(root_id_, id4.Get(PARENT_ID)); + EXPECT_TRUE(PSTR("sue") == id4.Get(NAME)); + EXPECT_TRUE(root_id_ == id4.Get(PARENT_ID)); EXPECT_FALSE(id4.Get(IS_UNSYNCED)); } syncer_events_.clear(); @@ -2703,26 +2692,26 @@ TEST_F(SyncerTest, FolderMergeWithChildNameClash) { ReadTransaction trans(dir, __FILE__, __LINE__); Directory::ChildHandles children; dir->GetChildHandles(&trans, root_id_, &children); - ASSERT_EQ(2, children.size()); + ASSERT_TRUE(2 == children.size()); Entry parent(&trans, GET_BY_ID, parent_id_); ASSERT_TRUE(parent.good()); - EXPECT_EQ(parent.Get(NAME), PSTR("Folder")); + EXPECT_TRUE(parent.Get(NAME) == PSTR("Folder")); if (local_folder_handle == children[0]) { - EXPECT_EQ(children[1], parent.Get(META_HANDLE)); + EXPECT_TRUE(children[1] == parent.Get(META_HANDLE)); } else { - EXPECT_EQ(children[0], parent.Get(META_HANDLE)); - EXPECT_EQ(children[1], local_folder_handle); + EXPECT_TRUE(children[0] == parent.Get(META_HANDLE)); + EXPECT_TRUE(children[1] == local_folder_handle); } dir->GetChildHandles(&trans, local_folder_id, &children); - EXPECT_EQ(1, children.size()); + EXPECT_TRUE(1 == children.size()); dir->GetChildHandles(&trans, parent_id_, &children); - EXPECT_EQ(1, children.size()); + EXPECT_TRUE(1 == children.size()); Directory::UnappliedUpdateMetaHandles unapplied; dir->GetUnappliedUpdateMetaHandles(&trans, &unapplied); - EXPECT_EQ(0, unapplied.size()); + EXPECT_TRUE(0 == unapplied.size()); syncable::Directory::UnsyncedMetaHandles unsynced; dir->GetUnsyncedMetaHandles(&trans, &unsynced); - EXPECT_EQ(2, unsynced.size()); + EXPECT_TRUE(2 == unsynced.size()); } mock_server_->set_conflict_all_commits(false); syncer_->SyncShare(); @@ -2730,7 +2719,7 @@ TEST_F(SyncerTest, FolderMergeWithChildNameClash) { ReadTransaction trans(dir, __FILE__, __LINE__); syncable::Directory::UnsyncedMetaHandles unsynced; dir->GetUnsyncedMetaHandles(&trans, &unsynced); - EXPECT_EQ(0, unsynced.size()); + EXPECT_TRUE(0 == unsynced.size()); } syncer_events_.clear(); } @@ -2785,8 +2774,8 @@ TEST_F(SyncerTest, SiblingDirectoriesBecomeCircular) { ASSERT_TRUE(A.good()); MutableEntry B(&wtrans, GET_BY_ID, ids_.FromNumber(2)); ASSERT_TRUE(B.good()); - EXPECT_EQ(A.Get(NAME), PSTR("B")); - EXPECT_EQ(B.Get(NAME), PSTR("B")); + EXPECT_TRUE(A.Get(NAME) == PSTR("B")); + EXPECT_TRUE(B.Get(NAME) == PSTR("B")); } } @@ -2947,7 +2936,7 @@ TEST_F(SyncerTest, DISABLED_ResolveWeDeletedTheyWrote) { ReadTransaction trans(dir, __FILE__, __LINE__); Entry bob(&trans, GET_BY_PARENTID_AND_NAME, trans.root_id(), PSTR("bob")); ASSERT_TRUE(bob.good()); - EXPECT_EQ(bob.Get(ID), ids_.FromNumber(1)); + EXPECT_TRUE(bob.Get(ID) == ids_.FromNumber(1)); EXPECT_FALSE(bob.Get(IS_UNSYNCED)); EXPECT_FALSE(bob.Get(IS_UNAPPLIED_UPDATE)); EXPECT_FALSE(bob.Get(IS_DEL)); @@ -2981,7 +2970,7 @@ TEST_F(SyncerTest, ServerDeletingFolderWeHaveMovedSomethingInto) { ASSERT_TRUE(fred.good()); EXPECT_TRUE(fred.Get(IS_UNSYNCED)); EXPECT_TRUE(bob.Get(IS_UNSYNCED)); - EXPECT_EQ(bob.Get(PARENT_ID), fred.Get(ID)); + EXPECT_TRUE(bob.Get(PARENT_ID) == fred.Get(ID)); EXPECT_FALSE(fred.Get(IS_UNAPPLIED_UPDATE)); EXPECT_FALSE(bob.Get(IS_UNAPPLIED_UPDATE)); } @@ -3025,7 +3014,7 @@ TEST_F(SyncerTest, DISABLED_ServerDeletingFolderWeHaveAnOpenEntryIn) { syncer_->SyncShare(state_.get()); syncer_->SyncShare(state_.get()); syncer_->SyncShare(state_.get()); - EXPECT_EQ(0, syncer_events_.size()); + EXPECT_TRUE(0 == syncer_events_.size()); { ReadTransaction trans(dir, __FILE__, __LINE__); Entry bob(&trans, GET_BY_ID, ids_.FromNumber(1)); @@ -3034,7 +3023,7 @@ TEST_F(SyncerTest, DISABLED_ServerDeletingFolderWeHaveAnOpenEntryIn) { ASSERT_TRUE(fred.good()); EXPECT_FALSE(fred.Get(IS_UNSYNCED)); EXPECT_TRUE(fred.Get(IS_UNAPPLIED_UPDATE)); - EXPECT_EQ(bob.Get(PARENT_ID), fred.Get(ID)); + EXPECT_TRUE(bob.Get(PARENT_ID) == fred.Get(ID)); EXPECT_FALSE(bob.Get(IS_UNAPPLIED_UPDATE)); } syncer_events_.clear(); @@ -3067,8 +3056,8 @@ TEST_F(SyncerTest, WeMovedSomethingIntoAFolderServerHasDeleted) { EXPECT_TRUE(fred.Get(IS_UNSYNCED)); EXPECT_FALSE(fred.Get(ID).ServerKnows()); EXPECT_TRUE(bob.Get(IS_UNSYNCED)); - EXPECT_EQ(bob.Get(PARENT_ID), fred.Get(ID)); - EXPECT_EQ(fred.Get(PARENT_ID), root_id_); + EXPECT_TRUE(bob.Get(PARENT_ID) == fred.Get(ID)); + EXPECT_TRUE(fred.Get(PARENT_ID) == root_id_); EXPECT_FALSE(fred.Get(IS_UNAPPLIED_UPDATE)); EXPECT_FALSE(bob.Get(IS_UNAPPLIED_UPDATE)); } @@ -3080,10 +3069,8 @@ namespace { int move_bob_count; bool MoveBobIntoID2(Directory* dir) { - int first_count = move_bob_count; if (--move_bob_count > 0) return false; - int second_count = move_bob_count; if (move_bob_count == 0) { WriteTransaction trans(dir, UNITTEST, __FILE__, __LINE__); Entry alice(&trans, GET_BY_ID, TestIdFactory::FromNumber(2)); @@ -3134,8 +3121,8 @@ TEST_F(SyncerTest, EXPECT_TRUE(alice.Get(IS_UNSYNCED)); EXPECT_FALSE(alice.Get(ID).ServerKnows()); EXPECT_TRUE(bob.Get(IS_UNSYNCED)); - EXPECT_EQ(bob.Get(PARENT_ID), alice.Get(ID)); - EXPECT_EQ(alice.Get(PARENT_ID), root_id_); + EXPECT_TRUE(bob.Get(PARENT_ID) == alice.Get(ID)); + EXPECT_TRUE(alice.Get(PARENT_ID) == root_id_); EXPECT_FALSE(alice.Get(IS_UNAPPLIED_UPDATE)); EXPECT_FALSE(bob.Get(IS_UNAPPLIED_UPDATE)); } @@ -3179,8 +3166,8 @@ TEST_F(SyncerTest, EXPECT_TRUE(fred.Get(IS_UNSYNCED)); EXPECT_FALSE(fred.Get(ID).ServerKnows()); EXPECT_TRUE(bob.Get(IS_UNSYNCED)); - EXPECT_EQ(bob.Get(PARENT_ID), fred.Get(ID)); - EXPECT_EQ(fred.Get(PARENT_ID), root_id_); + EXPECT_TRUE(bob.Get(PARENT_ID) == fred.Get(ID)); + EXPECT_TRUE(fred.Get(PARENT_ID) == root_id_); EXPECT_FALSE(fred.Get(IS_UNAPPLIED_UPDATE)); EXPECT_FALSE(bob.Get(IS_UNAPPLIED_UPDATE)); } @@ -3212,8 +3199,8 @@ TEST_F(SyncerTest, ServerMovedSomethingIntoAFolderWeHaveDeleted) { ASSERT_TRUE(fred.good()); EXPECT_FALSE(fred.Get(IS_UNSYNCED)); EXPECT_TRUE(bob.Get(IS_UNSYNCED)); - EXPECT_EQ(fred.Get(PARENT_ID), bob.Get(ID)); - EXPECT_EQ(bob.Get(PARENT_ID), root_id_); + EXPECT_TRUE(fred.Get(PARENT_ID) == bob.Get(ID)); + EXPECT_TRUE(bob.Get(PARENT_ID) == root_id_); EXPECT_FALSE(fred.Get(IS_UNAPPLIED_UPDATE)); EXPECT_FALSE(bob.Get(IS_UNAPPLIED_UPDATE)); } @@ -3248,8 +3235,8 @@ TEST_F(SyncerTest, ServerMovedAFolderIntoAFolderWeHaveDeletedAndMovedIntoIt) { EXPECT_TRUE(fred.Get(IS_UNSYNCED)); EXPECT_TRUE(bob.Get(IS_UNSYNCED)); EXPECT_TRUE(bob.Get(IS_DEL)); - EXPECT_EQ(fred.Get(PARENT_ID), root_id_); - EXPECT_EQ(bob.Get(PARENT_ID), fred.Get(ID)); + EXPECT_TRUE(fred.Get(PARENT_ID) == root_id_); + EXPECT_TRUE(bob.Get(PARENT_ID) == fred.Get(ID)); EXPECT_FALSE(fred.Get(IS_UNAPPLIED_UPDATE)); EXPECT_FALSE(bob.Get(IS_UNAPPLIED_UPDATE)); } @@ -3280,8 +3267,8 @@ TEST_F(SyncerTest, NewServerItemInAFolderWeHaveDeleted) { ASSERT_TRUE(fred.good()); EXPECT_FALSE(fred.Get(IS_UNSYNCED)); EXPECT_TRUE(bob.Get(IS_UNSYNCED)); - EXPECT_EQ(fred.Get(PARENT_ID), bob.Get(ID)); - EXPECT_EQ(bob.Get(PARENT_ID), root_id_); + EXPECT_TRUE(fred.Get(PARENT_ID) == bob.Get(ID)); + EXPECT_TRUE(bob.Get(PARENT_ID) == root_id_); EXPECT_FALSE(fred.Get(IS_UNAPPLIED_UPDATE)); EXPECT_FALSE(bob.Get(IS_UNAPPLIED_UPDATE)); } @@ -3320,9 +3307,9 @@ TEST_F(SyncerTest, NewServerItemInAFolderHierarchyWeHaveDeleted) { EXPECT_FALSE(fred.Get(IS_UNSYNCED)); EXPECT_TRUE(bob.Get(IS_UNSYNCED)); EXPECT_TRUE(joe.Get(IS_UNSYNCED)); - EXPECT_EQ(fred.Get(PARENT_ID), joe.Get(ID)); - EXPECT_EQ(joe.Get(PARENT_ID), bob.Get(ID)); - EXPECT_EQ(bob.Get(PARENT_ID), root_id_); + EXPECT_TRUE(fred.Get(PARENT_ID) == joe.Get(ID)); + EXPECT_TRUE(joe.Get(PARENT_ID) == bob.Get(ID)); + EXPECT_TRUE(bob.Get(PARENT_ID) == root_id_); EXPECT_FALSE(fred.Get(IS_UNAPPLIED_UPDATE)); EXPECT_FALSE(bob.Get(IS_UNAPPLIED_UPDATE)); EXPECT_FALSE(joe.Get(IS_UNAPPLIED_UPDATE)); @@ -3392,7 +3379,7 @@ void DeleteSusanInRoot(Directory* dir) { MutableEntry susan(&trans, GET_BY_PATH, PSTR("susan")); Directory::ChildHandles children; dir->GetChildHandles(&trans, susan.Get(ID), &children); - ASSERT_EQ(0, children.size()); + ASSERT_TRUE(0 == children.size()); susan.Put(IS_DEL, true); susan.Put(IS_UNSYNCED, true); } @@ -3444,7 +3431,7 @@ TEST_F(SyncerTest, NewServerItemInAFolderHierarchyWeHaveDeleted3) { EXPECT_TRUE(bob.Get(IS_UNSYNCED)); EXPECT_TRUE(joe.Get(IS_UNSYNCED)); } - EXPECT_EQ(0, countown_till_delete); + EXPECT_TRUE(0 == countown_till_delete); syncer_->pre_conflict_resolution_function_ = 0; LoopSyncShare(syncer_); LoopSyncShare(syncer_); @@ -3462,10 +3449,10 @@ TEST_F(SyncerTest, NewServerItemInAFolderHierarchyWeHaveDeleted3) { EXPECT_FALSE(fred.Get(IS_UNSYNCED)); EXPECT_TRUE(bob.Get(IS_UNSYNCED)); EXPECT_TRUE(joe.Get(IS_UNSYNCED)); - EXPECT_EQ(fred.Get(PARENT_ID), joe.Get(ID)); - EXPECT_EQ(joe.Get(PARENT_ID), bob.Get(ID)); - EXPECT_EQ(bob.Get(PARENT_ID), susan.Get(ID)); - EXPECT_EQ(susan.Get(PARENT_ID), root_id_); + EXPECT_TRUE(fred.Get(PARENT_ID) == joe.Get(ID)); + EXPECT_TRUE(joe.Get(PARENT_ID) == bob.Get(ID)); + EXPECT_TRUE(bob.Get(PARENT_ID) == susan.Get(ID)); + EXPECT_TRUE(susan.Get(PARENT_ID) == root_id_); EXPECT_FALSE(susan.Get(IS_UNAPPLIED_UPDATE)); EXPECT_FALSE(fred.Get(IS_UNAPPLIED_UPDATE)); EXPECT_FALSE(bob.Get(IS_UNAPPLIED_UPDATE)); @@ -3510,9 +3497,9 @@ TEST_F(SyncerTest, WeMovedSomethingIntoAFolderHierarchyServerHasDeleted) { EXPECT_TRUE(bob.Get(IS_UNSYNCED)); EXPECT_FALSE(fred.Get(ID).ServerKnows()); EXPECT_FALSE(alice.Get(ID).ServerKnows()); - EXPECT_EQ(alice.Get(PARENT_ID), fred.Get(ID)); - EXPECT_EQ(bob.Get(PARENT_ID), alice.Get(ID)); - EXPECT_EQ(fred.Get(PARENT_ID), root_id_); + EXPECT_TRUE(alice.Get(PARENT_ID) == fred.Get(ID)); + EXPECT_TRUE(bob.Get(PARENT_ID) == alice.Get(ID)); + EXPECT_TRUE(fred.Get(PARENT_ID) == root_id_); EXPECT_FALSE(fred.Get(IS_UNAPPLIED_UPDATE)); EXPECT_FALSE(bob.Get(IS_UNAPPLIED_UPDATE)); EXPECT_FALSE(alice.Get(IS_UNAPPLIED_UPDATE)); @@ -3567,10 +3554,10 @@ TEST_F(SyncerTest, WeMovedSomethingIntoAFolderHierarchyServerHasDeleted2) { EXPECT_TRUE(bob.Get(IS_UNSYNCED)); EXPECT_FALSE(fred.Get(ID).ServerKnows()); EXPECT_FALSE(alice.Get(ID).ServerKnows()); - EXPECT_EQ(alice.Get(PARENT_ID), fred.Get(ID)); - EXPECT_EQ(bob.Get(PARENT_ID), alice.Get(ID)); - EXPECT_EQ(fred.Get(PARENT_ID), susan.Get(ID)); - EXPECT_EQ(susan.Get(PARENT_ID), root_id_); + EXPECT_TRUE(alice.Get(PARENT_ID) == fred.Get(ID)); + EXPECT_TRUE(bob.Get(PARENT_ID) == alice.Get(ID)); + EXPECT_TRUE(fred.Get(PARENT_ID) == susan.Get(ID)); + EXPECT_TRUE(susan.Get(PARENT_ID) == root_id_); EXPECT_FALSE(fred.Get(IS_UNAPPLIED_UPDATE)); EXPECT_FALSE(bob.Get(IS_UNAPPLIED_UPDATE)); EXPECT_FALSE(alice.Get(IS_UNAPPLIED_UPDATE)); @@ -3598,11 +3585,11 @@ TEST_F(SyncerTest, DuplicateIDReturn) { folder2.Put(ID, syncable::Id::CreateFromServerId("mock_server:10000")); } mock_server_->set_next_new_id(10000); - EXPECT_EQ(1, dir->unsynced_entity_count()); + EXPECT_TRUE(1 == dir->unsynced_entity_count()); syncer_->SyncShare(); // we get back a bad id in here (should never happen). - EXPECT_EQ(1, dir->unsynced_entity_count()); + EXPECT_TRUE(1 == dir->unsynced_entity_count()); syncer_->SyncShare(); // another bad id in here. - EXPECT_EQ(0, dir->unsynced_entity_count()); + EXPECT_TRUE(0 == dir->unsynced_entity_count()); syncer_events_.clear(); } @@ -3716,11 +3703,11 @@ TEST_F(SyncerTest, ConflictResolverMergesLocalDeleteAndServerUpdate) { { ReadTransaction trans(dir, __FILE__, __LINE__); Entry local_deleted(&trans, GET_BY_ID, ids_.FromNumber(1)); - EXPECT_EQ(local_deleted.Get(BASE_VERSION), 10); - EXPECT_EQ(local_deleted.Get(IS_UNAPPLIED_UPDATE), false); - EXPECT_EQ(local_deleted.Get(IS_UNSYNCED), true); - EXPECT_EQ(local_deleted.Get(IS_DEL), true); - EXPECT_EQ(local_deleted.Get(IS_DIR), false); + EXPECT_TRUE(local_deleted.Get(BASE_VERSION) == 10); + EXPECT_TRUE(local_deleted.Get(IS_UNAPPLIED_UPDATE) == false); + EXPECT_TRUE(local_deleted.Get(IS_UNSYNCED) == true); + EXPECT_TRUE(local_deleted.Get(IS_DEL) == true); + EXPECT_TRUE(local_deleted.Get(IS_DIR) == false); } } @@ -3754,11 +3741,11 @@ TEST_F(SyncerTest, UpdateFlipsTheFolderBit) { { ReadTransaction trans(dir, __FILE__, __LINE__); Entry local_deleted(&trans, GET_BY_ID, ids_.FromNumber(1)); - EXPECT_EQ(local_deleted.Get(BASE_VERSION), 1); - EXPECT_EQ(local_deleted.Get(IS_UNAPPLIED_UPDATE), false); - EXPECT_EQ(local_deleted.Get(IS_UNSYNCED), true); - EXPECT_EQ(local_deleted.Get(IS_DEL), true); - EXPECT_EQ(local_deleted.Get(IS_DIR), true); + EXPECT_TRUE(local_deleted.Get(BASE_VERSION) == 1); + EXPECT_TRUE(local_deleted.Get(IS_UNAPPLIED_UPDATE) == false); + EXPECT_TRUE(local_deleted.Get(IS_UNSYNCED) == true); + EXPECT_TRUE(local_deleted.Get(IS_DEL) == true); + EXPECT_TRUE(local_deleted.Get(IS_DIR) == true); } } @@ -3773,23 +3760,23 @@ TEST(SyncerSyncProcessState, MergeSetsTest) { c.MergeSets(id[2], id[3]); c.MergeSets(id[4], id[5]); c.MergeSets(id[5], id[6]); - EXPECT_EQ(6, c.IdToConflictSetSize()); + EXPECT_TRUE(6 == c.IdToConflictSetSize()); for (int i = 1; i < 7; i++) { EXPECT_TRUE(NULL != c.IdToConflictSetGet(id[i])); - EXPECT_EQ(c.IdToConflictSetGet(id[(i & ~3) + 1]), - c.IdToConflictSetGet(id[i])); + EXPECT_TRUE(c.IdToConflictSetGet(id[(i & ~3) + 1]) == + c.IdToConflictSetGet(id[i])); } c.MergeSets(id[1], id[6]); for (int i = 1; i < 7; i++) { EXPECT_TRUE(NULL != c.IdToConflictSetGet(id[i])); - EXPECT_EQ(c.IdToConflictSetGet(id[1]), c.IdToConflictSetGet(id[i])); + EXPECT_TRUE(c.IdToConflictSetGet(id[1]) == c.IdToConflictSetGet(id[i])); } // Check dupes don't cause double sets. SyncProcessState identical_set; identical_set.MergeSets(id[1], id[1]); - EXPECT_EQ(identical_set.IdToConflictSetSize(), 1); - EXPECT_EQ(identical_set.IdToConflictSetGet(id[1])->size(), 1); + EXPECT_TRUE(identical_set.IdToConflictSetSize() == 1); + EXPECT_TRUE(identical_set.IdToConflictSetGet(id[1])->size() == 1); } // Bug Synopsis: @@ -3949,7 +3936,7 @@ TEST_F(SyncerTest, QuicklyMergeDualCreatedHierarchy) { syncer_->SyncShare(state_.get()); SyncerStatus status(NULL, state_.get()); EXPECT_LT(status.consecutive_problem_commits(), 5); - EXPECT_EQ(0, dir->unsynced_entity_count()); + EXPECT_TRUE(0 == dir->unsynced_entity_count()); } TEST(SortedCollectionsIntersect, SortedCollectionsIntersectTest) { @@ -4050,7 +4037,7 @@ void CheckEntryVersion(syncable::DirectoryManager* dirmgr, PathString name) { ReadTransaction trans(dir, __FILE__, __LINE__); Entry entry(&trans, GET_BY_PATH, PSTR("foo")); ASSERT_TRUE(entry.good()); - EXPECT_EQ(entry.Get(BASE_VERSION), 1); + EXPECT_TRUE(entry.Get(BASE_VERSION) == 1); } } // namespace @@ -4089,8 +4076,8 @@ TEST_F(SyncerTest, TestClientCommand) { EXPECT_TRUE(last_client_command_.has_set_sync_poll_interval()); EXPECT_TRUE(last_client_command_.has_set_sync_long_poll_interval()); - EXPECT_EQ(8, last_client_command_.set_sync_poll_interval()); - EXPECT_EQ(800, last_client_command_.set_sync_long_poll_interval()); + EXPECT_TRUE(8 == last_client_command_.set_sync_poll_interval()); + EXPECT_TRUE(800 == last_client_command_.set_sync_long_poll_interval()); command = mock_server_->GetNextClientCommand(); command->set_set_sync_poll_interval(180); @@ -4100,8 +4087,8 @@ TEST_F(SyncerTest, TestClientCommand) { EXPECT_TRUE(last_client_command_.has_set_sync_poll_interval()); EXPECT_TRUE(last_client_command_.has_set_sync_long_poll_interval()); - EXPECT_EQ(180, last_client_command_.set_sync_poll_interval()); - EXPECT_EQ(190, last_client_command_.set_sync_long_poll_interval()); + EXPECT_TRUE(180 == last_client_command_.set_sync_poll_interval()); + EXPECT_TRUE(190 == last_client_command_.set_sync_long_poll_interval()); } TEST_F(SyncerTest, EnsureWeSendUpOldParent) { @@ -4123,9 +4110,9 @@ TEST_F(SyncerTest, EnsureWeSendUpOldParent) { } syncer_->SyncShare(); const sync_pb::CommitMessage& commit = mock_server_->last_sent_commit(); - ASSERT_EQ(2, commit.entries_size()); - EXPECT_EQ(commit.entries(0).parent_id_string(), "2"); - EXPECT_EQ(commit.entries(0).old_parent_id(), "0"); + ASSERT_TRUE(2 == commit.entries_size()); + EXPECT_TRUE(commit.entries(0).parent_id_string() == "2"); + EXPECT_TRUE(commit.entries(0).old_parent_id() == "0"); EXPECT_FALSE(commit.entries(1).has_old_parent_id()); } @@ -4148,7 +4135,7 @@ TEST_F(SyncerTest, Test64BitVersionSupport) { ReadTransaction rtrans(dir, __FILE__, __LINE__); Entry entry(&rtrans, syncable::GET_BY_PATH, name); ASSERT_TRUE(entry.good()); - EXPECT_EQ(really_big_int, entry.Get(syncable::BASE_VERSION)); + EXPECT_TRUE(really_big_int == entry.Get(syncable::BASE_VERSION)); } TEST_F(SyncerTest, TestDSStoreDirectorySyncsNormally) { @@ -4291,18 +4278,18 @@ TEST_F(SyncerTest, CopySyncProcessState) { a.MergeSets(ids_.FromNumber(1), ids_.FromNumber(2)); a.MergeSets(ids_.FromNumber(2), ids_.FromNumber(3)); a.MergeSets(ids_.FromNumber(4), ids_.FromNumber(5)); - EXPECT_EQ(a.ConflictSetsSize(), 2); + EXPECT_TRUE(a.ConflictSetsSize() == 2); { SyncProcessState b = a; b = b; - EXPECT_EQ(b.ConflictSetsSize(), 2); + EXPECT_TRUE(b.ConflictSetsSize() == 2); } - EXPECT_EQ(a.ConflictSetsSize(), 2); + EXPECT_TRUE(a.ConflictSetsSize() == 2); a.MergeSets(ids_.FromNumber(3), ids_.FromNumber(4)); - EXPECT_EQ(a.ConflictSetsSize(), 1); + EXPECT_TRUE(a.ConflictSetsSize() == 1); b.reset(new SyncProcessState(a)); } - EXPECT_EQ(b->ConflictSetsSize(), 1); + EXPECT_TRUE(b->ConflictSetsSize() == 1); } TEST_F(SyncerTest, SingletonTagUpdates) { @@ -4379,12 +4366,12 @@ class SyncerPositionUpdateTest : public SyncerTest { Id id = i->second; Entry entry_with_id(&trans, GET_BY_ID, id); EXPECT_TRUE(entry_with_id.good()); - EXPECT_EQ(entry_with_id.Get(PREV_ID), prev_id); - EXPECT_EQ(entry_with_id.Get(SERVER_POSITION_IN_PARENT), i->first); + EXPECT_TRUE(entry_with_id.Get(PREV_ID) == prev_id); + EXPECT_TRUE(entry_with_id.Get(SERVER_POSITION_IN_PARENT) == i->first); if (next == position_map_.end()) { EXPECT_TRUE(entry_with_id.Get(NEXT_ID).IsRoot()); } else { - EXPECT_EQ(entry_with_id.Get(NEXT_ID), next->second); + EXPECT_TRUE(entry_with_id.Get(NEXT_ID) == next->second); next++; } prev_id = id; @@ -4510,12 +4497,12 @@ class SyncerPositionTiebreakingTest : public SyncerTest { EXPECT_TRUE(low.good()); EXPECT_TRUE(mid.good()); EXPECT_TRUE(high.good()); - EXPECT_EQ(low.Get(PREV_ID), null_id); - EXPECT_EQ(mid.Get(PREV_ID), low_id_); - EXPECT_EQ(high.Get(PREV_ID), mid_id_); - EXPECT_EQ(high.Get(NEXT_ID), null_id); - EXPECT_EQ(mid.Get(NEXT_ID), high_id_); - EXPECT_EQ(low.Get(NEXT_ID), mid_id_); + EXPECT_TRUE(low.Get(PREV_ID) == null_id); + EXPECT_TRUE(mid.Get(PREV_ID) == low_id_); + EXPECT_TRUE(high.Get(PREV_ID) == mid_id_); + EXPECT_TRUE(high.Get(NEXT_ID) == null_id); + EXPECT_TRUE(mid.Get(NEXT_ID) == high_id_); + EXPECT_TRUE(low.Get(NEXT_ID) == mid_id_); } protected: diff --git a/chrome/browser/sync/glue/http_bridge_unittest.cc b/chrome/browser/sync/glue/http_bridge_unittest.cc index b0177d6..62892af 100644 --- a/chrome/browser/sync/glue/http_bridge_unittest.cc +++ b/chrome/browser/sync/glue/http_bridge_unittest.cc @@ -13,13 +13,14 @@ using browser_sync::HttpBridge; namespace { // TODO(timsteele): Should use PathService here. See Chromium Issue 3113. -const char16 kDocRoot[] = L"chrome/test/data"; +const wchar_t kDocRoot[] = L"chrome/test/data"; } class HttpBridgeTest : public testing::Test { public: - HttpBridgeTest() : io_thread_("HttpBridgeTest IO thread"), - fake_default_request_context_(NULL) { + HttpBridgeTest() + : fake_default_request_context_(NULL), + io_thread_("HttpBridgeTest IO thread") { } virtual void SetUp() { @@ -125,8 +126,8 @@ TEST_F(HttpBridgeTest, TestMakeSynchronousPostShunted) { // Full round-trip test of the HttpBridge, using default UA string and // no request cookies. TEST_F(HttpBridgeTest, TestMakeSynchronousPostLiveWithPayload) { - scoped_refptr<HTTPTestServer> server = HTTPTestServer::CreateServer(kDocRoot, - NULL); + scoped_refptr<HTTPTestServer> server = + HTTPTestServer::CreateServer(kDocRoot, NULL); ASSERT_TRUE(NULL != server.get()); scoped_refptr<HttpBridge> http_bridge(BuildBridge()); @@ -143,14 +144,15 @@ TEST_F(HttpBridgeTest, TestMakeSynchronousPostLiveWithPayload) { EXPECT_EQ(200, response_code); EXPECT_EQ(0, os_error); - EXPECT_EQ(payload.length() + 1, http_bridge->GetResponseContentLength()); + EXPECT_EQ(payload.length() + 1, + static_cast<size_t>(http_bridge->GetResponseContentLength())); EXPECT_EQ(payload, std::string(http_bridge->GetResponseContent())); } // Full round-trip test of the HttpBridge, using custom UA string TEST_F(HttpBridgeTest, TestMakeSynchronousPostLiveComprehensive) { - scoped_refptr<HTTPTestServer> server = HTTPTestServer::CreateServer(kDocRoot, - NULL); + scoped_refptr<HTTPTestServer> server = + HTTPTestServer::CreateServer(kDocRoot, NULL); ASSERT_TRUE(NULL != server.get()); scoped_refptr<HttpBridge> http_bridge(BuildBridge()); @@ -177,8 +179,8 @@ TEST_F(HttpBridgeTest, TestMakeSynchronousPostLiveComprehensive) { } TEST_F(HttpBridgeTest, TestExtraRequestHeaders) { - scoped_refptr<HTTPTestServer> server = HTTPTestServer::CreateServer(kDocRoot, - NULL); + scoped_refptr<HTTPTestServer> server = + HTTPTestServer::CreateServer(kDocRoot, NULL); ASSERT_TRUE(NULL != server.get()); scoped_refptr<HttpBridge> http_bridge(BuildBridge()); diff --git a/chrome/browser/sync/notifier/listener/talk_mediator_unittest.cc b/chrome/browser/sync/notifier/listener/talk_mediator_unittest.cc index 680e7e0..fb5e9a9 100644 --- a/chrome/browser/sync/notifier/listener/talk_mediator_unittest.cc +++ b/chrome/browser/sync/notifier/listener/talk_mediator_unittest.cc @@ -44,34 +44,34 @@ TEST_F(TalkMediatorImplTest, SetAuthTokenWithBadInput) { scoped_ptr<TalkMediatorImpl> talk1(new TalkMediatorImpl( new MockMediatorThread())); ASSERT_FALSE(talk1->SetAuthToken("@missinguser.com", "")); - ASSERT_EQ(talk1->state_.initialized, 0); + ASSERT_TRUE(talk1->state_.initialized == 0); scoped_ptr<TalkMediatorImpl> talk2(new TalkMediatorImpl( new MockMediatorThread())); ASSERT_FALSE(talk2->SetAuthToken("", "1234567890")); - ASSERT_EQ(talk2->state_.initialized, 0); + ASSERT_TRUE(talk2->state_.initialized == 0); scoped_ptr<TalkMediatorImpl> talk3(new TalkMediatorImpl( new MockMediatorThread())); ASSERT_FALSE(talk3->SetAuthToken("missingdomain", "abcde")); - ASSERT_EQ(talk3->state_.initialized, 0); + ASSERT_TRUE(talk3->state_.initialized == 0); } TEST_F(TalkMediatorImplTest, SetAuthTokenWithGoodInput) { scoped_ptr<TalkMediatorImpl> talk1(new TalkMediatorImpl( new MockMediatorThread())); ASSERT_TRUE(talk1->SetAuthToken("chromium@gmail.com", "token")); - ASSERT_EQ(talk1->state_.initialized, 1); + ASSERT_TRUE(talk1->state_.initialized == 1); scoped_ptr<TalkMediatorImpl> talk2(new TalkMediatorImpl( new MockMediatorThread())); ASSERT_TRUE(talk2->SetAuthToken("chromium@mail.google.com", "token")); - ASSERT_EQ(talk2->state_.initialized, 1); + ASSERT_TRUE(talk2->state_.initialized == 1); scoped_ptr<TalkMediatorImpl> talk3(new TalkMediatorImpl( new MockMediatorThread())); ASSERT_TRUE(talk3->SetAuthToken("chromium@chromium.org", "token")); - ASSERT_EQ(talk3->state_.initialized, 1); + ASSERT_TRUE(talk3->state_.initialized == 1); } TEST_F(TalkMediatorImplTest, LoginWiring) { @@ -80,24 +80,24 @@ TEST_F(TalkMediatorImplTest, LoginWiring) { scoped_ptr<TalkMediatorImpl> talk1(new TalkMediatorImpl(mock)); // Login checks states for initialization. - ASSERT_EQ(talk1->Login(), false); - ASSERT_EQ(mock->login_calls, 0); + ASSERT_TRUE(talk1->Login() == false); + ASSERT_TRUE(mock->login_calls == 0); - ASSERT_EQ(talk1->SetAuthToken("chromium@gmail.com", "token"), true); - ASSERT_EQ(talk1->Login(), true); - ASSERT_EQ(mock->login_calls, 1); + ASSERT_TRUE(talk1->SetAuthToken("chromium@gmail.com", "token") == true); + ASSERT_TRUE(talk1->Login() == true); + ASSERT_TRUE(mock->login_calls == 1); // Successive calls to login will fail. One needs to create a new talk // mediator object. - ASSERT_EQ(talk1->Login(), false); - ASSERT_EQ(mock->login_calls, 1); + ASSERT_TRUE(talk1->Login() == false); + ASSERT_TRUE(mock->login_calls == 1); - ASSERT_EQ(talk1->Logout(), true); - ASSERT_EQ(mock->logout_calls, 1); + ASSERT_TRUE(talk1->Logout() == true); + ASSERT_TRUE(mock->logout_calls == 1); // Successive logout calls do nothing. - ASSERT_EQ(talk1->Logout(), false); - ASSERT_EQ(mock->logout_calls, 1); + ASSERT_TRUE(talk1->Logout() == false); + ASSERT_TRUE(mock->logout_calls == 1); } TEST_F(TalkMediatorImplTest, SendNotification) { @@ -106,31 +106,31 @@ TEST_F(TalkMediatorImplTest, SendNotification) { scoped_ptr<TalkMediatorImpl> talk1(new TalkMediatorImpl(mock)); // Failure due to not being logged in. - ASSERT_EQ(talk1->SendNotification(), false); - ASSERT_EQ(mock->send_calls, 0); + ASSERT_TRUE(talk1->SendNotification() == false); + ASSERT_TRUE(mock->send_calls == 0); - ASSERT_EQ(talk1->SetAuthToken("chromium@gmail.com", "token"), true); - ASSERT_EQ(talk1->Login(), true); - ASSERT_EQ(mock->login_calls, 1); + ASSERT_TRUE(talk1->SetAuthToken("chromium@gmail.com", "token") == true); + ASSERT_TRUE(talk1->Login() == true); + ASSERT_TRUE(mock->login_calls == 1); // Failure due to not being subscribed. - ASSERT_EQ(talk1->SendNotification(), false); - ASSERT_EQ(mock->send_calls, 0); + ASSERT_TRUE(talk1->SendNotification() == false); + ASSERT_TRUE(mock->send_calls == 0); // Fake subscription talk1->OnSubscriptionSuccess(); - ASSERT_EQ(talk1->state_.subscribed, 1); - ASSERT_EQ(talk1->SendNotification(), true); - ASSERT_EQ(mock->send_calls, 1); - ASSERT_EQ(talk1->SendNotification(), true); - ASSERT_EQ(mock->send_calls, 2); + ASSERT_TRUE(talk1->state_.subscribed == 1); + ASSERT_TRUE(talk1->SendNotification() == true); + ASSERT_TRUE(mock->send_calls == 1); + ASSERT_TRUE(talk1->SendNotification() == true); + ASSERT_TRUE(mock->send_calls == 2); - ASSERT_EQ(talk1->Logout(), true); - ASSERT_EQ(mock->logout_calls, 1); + ASSERT_TRUE(talk1->Logout() == true); + ASSERT_TRUE(mock->logout_calls == 1); // Failure due to being logged out. - ASSERT_EQ(talk1->SendNotification(), false); - ASSERT_EQ(mock->send_calls, 2); + ASSERT_TRUE(talk1->SendNotification() == false); + ASSERT_TRUE(mock->send_calls == 2); } TEST_F(TalkMediatorImplTest, MediatorThreadCallbacks) { @@ -141,35 +141,35 @@ TEST_F(TalkMediatorImplTest, MediatorThreadCallbacks) { scoped_ptr<EventListenerHookup> callback(NewEventListenerHookup( talk1->channel(), this, &TalkMediatorImplTest::HandleTalkMediatorEvent)); - ASSERT_EQ(talk1->SetAuthToken("chromium@gmail.com", "token"), true); - ASSERT_EQ(talk1->Login(), true); - ASSERT_EQ(mock->login_calls, 1); + ASSERT_TRUE(talk1->SetAuthToken("chromium@gmail.com", "token") == true); + ASSERT_TRUE(talk1->Login() == true); + ASSERT_TRUE(mock->login_calls == 1); mock->ChangeState(MediatorThread::MSG_LOGGED_IN); - ASSERT_EQ(last_message_, TalkMediatorEvent::LOGIN_SUCCEEDED); + ASSERT_TRUE(last_message_ == TalkMediatorEvent::LOGIN_SUCCEEDED); // The message triggers calls to listen and subscribe. - ASSERT_EQ(mock->listen_calls, 1); - ASSERT_EQ(mock->subscribe_calls, 1); - ASSERT_EQ(talk1->state_.subscribed, 0); + ASSERT_TRUE(mock->listen_calls == 1); + ASSERT_TRUE(mock->subscribe_calls == 1); + ASSERT_TRUE(talk1->state_.subscribed == 0); mock->ChangeState(MediatorThread::MSG_SUBSCRIPTION_SUCCESS); - ASSERT_EQ(last_message_, TalkMediatorEvent::SUBSCRIPTIONS_ON); - ASSERT_EQ(talk1->state_.subscribed, 1); + ASSERT_TRUE(last_message_ == TalkMediatorEvent::SUBSCRIPTIONS_ON); + ASSERT_TRUE(talk1->state_.subscribed == 1); // After subscription success is receieved, the talk mediator will allow // sending of notifications. - ASSERT_EQ(talk1->SendNotification(), true); - ASSERT_EQ(mock->send_calls, 1); + ASSERT_TRUE(talk1->SendNotification() == true); + ASSERT_TRUE(mock->send_calls == 1); // |MSG_NOTIFICATION_RECEIVED| from the MediatorThread triggers a callback // of type |NOTIFICATION_RECEIVED|. mock->ChangeState(MediatorThread::MSG_NOTIFICATION_RECEIVED); - ASSERT_EQ(last_message_, TalkMediatorEvent::NOTIFICATION_RECEIVED); + ASSERT_TRUE(last_message_ == TalkMediatorEvent::NOTIFICATION_RECEIVED); // A |TALKMEDIATOR_DESTROYED| message is received during tear down. talk1.reset(); - ASSERT_EQ(last_message_, TalkMediatorEvent::TALKMEDIATOR_DESTROYED); + ASSERT_TRUE(last_message_ == TalkMediatorEvent::TALKMEDIATOR_DESTROYED); } } // namespace browser_sync diff --git a/chrome/browser/sync/syncable/syncable_unittest.cc b/chrome/browser/sync/syncable/syncable_unittest.cc index e271ade..b1e1b10 100644 --- a/chrome/browser/sync/syncable/syncable_unittest.cc +++ b/chrome/browser/sync/syncable/syncable_unittest.cc @@ -22,7 +22,6 @@ #if !defined(OS_WIN) #define MAX_PATH PATH_MAX -#include <strstream> #include <ostream> #include <stdio.h> #include <sys/ipc.h> @@ -203,7 +202,7 @@ class SyncableDirectoryTest : public testing::Test { PathRemove(PathString(kSqlite3File)); dir_.reset(new Directory()); ASSERT_TRUE(dir_.get()); - ASSERT_EQ(OPENED, dir_->Open(kFilePath, kName)); + ASSERT_TRUE(OPENED == dir_->Open(kFilePath, kName)); ASSERT_TRUE(dir_->good()); } @@ -320,7 +319,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnsynced) { WriteTransaction trans(dir_.get(), UNITTEST, __FILE__, __LINE__); dir_->GetUnsyncedMetaHandles(&trans, &handles); - ASSERT_EQ(0, handles.size()); + ASSERT_TRUE(0 == handles.size()); MutableEntry e1(&trans, CREATE, trans.root_id(), PSTR("abba")); ASSERT_TRUE(e1.good()); @@ -340,7 +339,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnsynced) { WriteTransaction trans(dir_.get(), UNITTEST, __FILE__, __LINE__); dir_->GetUnsyncedMetaHandles(&trans, &handles); - ASSERT_EQ(0, handles.size()); + ASSERT_TRUE(0 == handles.size()); MutableEntry e3(&trans, GET_BY_HANDLE, handle1); ASSERT_TRUE(e3.good()); @@ -350,7 +349,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnsynced) { { WriteTransaction trans(dir_.get(), UNITTEST, __FILE__, __LINE__); dir_->GetUnsyncedMetaHandles(&trans, &handles); - ASSERT_EQ(1, handles.size()); + ASSERT_TRUE(1 == handles.size()); ASSERT_TRUE(handle1 == handles[0]); MutableEntry e4(&trans, GET_BY_HANDLE, handle2); @@ -361,7 +360,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnsynced) { { WriteTransaction trans(dir_.get(), UNITTEST, __FILE__, __LINE__); dir_->GetUnsyncedMetaHandles(&trans, &handles); - ASSERT_EQ(2, handles.size()); + ASSERT_TRUE(2 == handles.size()); if (handle1 == handles[0]) { ASSERT_TRUE(handle2 == handles[1]); } else { @@ -379,7 +378,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnsynced) { { WriteTransaction trans(dir_.get(), UNITTEST, __FILE__, __LINE__); dir_->GetUnsyncedMetaHandles(&trans, &handles); - ASSERT_EQ(1, handles.size()); + ASSERT_TRUE(1 == handles.size()); ASSERT_TRUE(handle2 == handles[0]); } } @@ -391,7 +390,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnappliedUpdates) { WriteTransaction trans(dir_.get(), UNITTEST, __FILE__, __LINE__); dir_->GetUnappliedUpdateMetaHandles(&trans, &handles); - ASSERT_EQ(0, handles.size()); + ASSERT_TRUE(0 == handles.size()); MutableEntry e1(&trans, CREATE, trans.root_id(), PSTR("abba")); ASSERT_TRUE(e1.good()); @@ -413,7 +412,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnappliedUpdates) { WriteTransaction trans(dir_.get(), UNITTEST, __FILE__, __LINE__); dir_->GetUnappliedUpdateMetaHandles(&trans, &handles); - ASSERT_EQ(0, handles.size()); + ASSERT_TRUE(0 == handles.size()); MutableEntry e3(&trans, GET_BY_HANDLE, handle1); ASSERT_TRUE(e3.good()); @@ -423,7 +422,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnappliedUpdates) { { WriteTransaction trans(dir_.get(), UNITTEST, __FILE__, __LINE__); dir_->GetUnappliedUpdateMetaHandles(&trans, &handles); - ASSERT_EQ(1, handles.size()); + ASSERT_TRUE(1 == handles.size()); ASSERT_TRUE(handle1 == handles[0]); MutableEntry e4(&trans, GET_BY_HANDLE, handle2); @@ -434,7 +433,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnappliedUpdates) { { WriteTransaction trans(dir_.get(), UNITTEST, __FILE__, __LINE__); dir_->GetUnappliedUpdateMetaHandles(&trans, &handles); - ASSERT_EQ(2, handles.size()); + ASSERT_TRUE(2 == handles.size()); if (handle1 == handles[0]) { ASSERT_TRUE(handle2 == handles[1]); } else { @@ -450,7 +449,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnappliedUpdates) { { WriteTransaction trans(dir_.get(), UNITTEST, __FILE__, __LINE__); dir_->GetUnappliedUpdateMetaHandles(&trans, &handles); - ASSERT_EQ(1, handles.size()); + ASSERT_TRUE(1 == handles.size()); ASSERT_TRUE(handle2 == handles[0]); } } @@ -533,7 +532,7 @@ TEST_F(SyncableDirectoryTest, TestIsLegalNewParent) { grandchild2.Put(BASE_VERSION, 1); // resulting tree // root - // / \ + // / | // parent parent2 // | | // child child2 @@ -572,7 +571,7 @@ TEST_F(SyncableDirectoryTest, TestFindEntryInFolder) { PSTR("folder") + kPathSeparator + PSTR("entry")); ASSERT_TRUE(entry.good()); - ASSERT_EQ(entry.Get(META_HANDLE), entry_handle); + ASSERT_TRUE(entry.Get(META_HANDLE) == entry_handle); } } @@ -593,13 +592,13 @@ TEST_F(SyncableDirectoryTest, TestGetByParentIdAndName) { MutableEntry entry(&wtrans, GET_BY_PARENTID_AND_NAME, wtrans.root_id(), name); ASSERT_TRUE(entry.good()); - ASSERT_EQ(id, entry.Get(ID)); + ASSERT_TRUE(id == entry.Get(ID)); } { ReadTransaction trans(dir_.get(), __FILE__, __LINE__); Entry entry(&trans, GET_BY_PARENTID_AND_NAME, trans.root_id(), name); ASSERT_TRUE(entry.good()); - ASSERT_EQ(id, entry.Get(ID)); + ASSERT_TRUE(id == entry.Get(ID)); } } @@ -724,7 +723,7 @@ TEST_F(SyncableDirectoryTest, TestSaveChangesFailure) { dir_.reset(new TestUnsaveableDirectory()); ASSERT_TRUE(dir_.get()); - ASSERT_EQ(OPENED, dir_->Open(kFilePath, kName)); + ASSERT_TRUE(OPENED == dir_->Open(kFilePath, kName)); ASSERT_TRUE(dir_->good()); int64 handle2 = 0; { @@ -769,10 +768,10 @@ void SyncableDirectoryTest::ValidateEntry(BaseTransaction* trans, int64 id, Entry e(trans, GET_BY_ID, TestIdFactory::FromNumber(id)); ASSERT_TRUE(e.good()); if (check_name) - ASSERT_EQ(name, e.Get(NAME)); - ASSERT_EQ(base_version, e.Get(BASE_VERSION)); - ASSERT_EQ(server_version, e.Get(SERVER_VERSION)); - ASSERT_EQ(is_del, e.Get(IS_DEL)); + ASSERT_TRUE(name == e.Get(NAME)); + ASSERT_TRUE(base_version == e.Get(BASE_VERSION)); + ASSERT_TRUE(server_version == e.Get(SERVER_VERSION)); + ASSERT_TRUE(is_del == e.Get(IS_DEL)); } TEST(SyncableDirectoryManager, TestFileRelease) { @@ -782,7 +781,7 @@ TEST(SyncableDirectoryManager, TestFileRelease) { ScopedDirLookup(&dm, PSTR("ScopeTest")); } dm.Close(PSTR("ScopeTest")); - ASSERT_EQ(0, PathRemove(dm.GetSyncDataDatabasePath())); + ASSERT_TRUE(0 == PathRemove(dm.GetSyncDataDatabasePath())); } static void* OpenTestThreadMain(void* arg) { @@ -794,9 +793,9 @@ static void* OpenTestThreadMain(void* arg) { TEST(SyncableDirectoryManager, ThreadOpenTest) { DirectoryManager dm(PSTR(".")); pthread_t thread; - ASSERT_EQ(0, pthread_create(&thread, 0, OpenTestThreadMain, &dm)); + ASSERT_TRUE(0 == pthread_create(&thread, 0, OpenTestThreadMain, &dm)); void* result; - ASSERT_EQ(0, pthread_join(thread, &result)); + ASSERT_TRUE(0 == pthread_join(thread, &result)); { ScopedDirLookup dir(&dm, PSTR("Open")); ASSERT_TRUE(dir.good()); @@ -874,11 +873,11 @@ TEST(SyncableDirectoryManager, ThreadBug1) { ThreadArg arg1 = { 0, &step, &dirman }; ThreadArg arg2 = { 1, &step, &dirman }; pthread_t thread1, thread2; - ASSERT_EQ(0, pthread_create(&thread1, NULL, &ThreadMain, &arg1)); - ASSERT_EQ(0, pthread_create(&thread2, NULL, &ThreadMain, &arg2)); + ASSERT_TRUE(0 == pthread_create(&thread1, NULL, &ThreadMain, &arg1)); + ASSERT_TRUE(0 == pthread_create(&thread2, NULL, &ThreadMain, &arg2)); void* retval; - ASSERT_EQ(0, pthread_join(thread1, &retval)); - ASSERT_EQ(0, pthread_join(thread2, &retval)); + ASSERT_TRUE(0 == pthread_join(thread1, &retval)); + ASSERT_TRUE(0 == pthread_join(thread2, &retval)); } namespace DirectoryKernelStalenessBug { @@ -966,11 +965,11 @@ TEST(SyncableDirectoryManager, DirectoryKernelStalenessBug) { ThreadArg arg1 = { 0, &step, &dirman }; ThreadArg arg2 = { 1, &step, &dirman }; pthread_t thread1, thread2; - ASSERT_EQ(0, pthread_create(&thread1, NULL, &ThreadMain, &arg1)); - ASSERT_EQ(0, pthread_create(&thread2, NULL, &ThreadMain, &arg2)); + ASSERT_TRUE(0 == pthread_create(&thread1, NULL, &ThreadMain, &arg1)); + ASSERT_TRUE(0 == pthread_create(&thread2, NULL, &ThreadMain, &arg2)); void* retval; - ASSERT_EQ(0, pthread_join(thread1, &retval)); - ASSERT_EQ(0, pthread_join(thread2, &retval)); + ASSERT_TRUE(0 == pthread_join(thread1, &retval)); + ASSERT_TRUE(0 == pthread_join(thread2, &retval)); } timespec operator + (const timespec& a, const timespec& b) { @@ -1049,63 +1048,16 @@ TEST(SyncableDirectory, StressTransactions) { for (int i = 0; i < kThreadCount; ++i) { thread_args[i].thread_number = i; thread_args[i].globals = &globals; - ASSERT_EQ(0, pthread_create(threads + i, NULL, &ThreadMain, + ASSERT_TRUE(0 == pthread_create(threads + i, NULL, &ThreadMain, thread_args + i)); } void* retval; for (pthread_t* i = threads; i < threads + kThreadCount; ++i) - ASSERT_EQ(0, pthread_join(*i, &retval)); + ASSERT_TRUE(0 == pthread_join(*i, &retval)); dirman.Close(globals.dirname); PathRemove(dirman.GetSyncDataDatabasePath()); } -static PathString UTF8ToPathStringQuick(const char* str) { - PathString ret; - CHECK(browser_sync::UTF8ToPathString(str, strlen(str), &ret)); - return ret; -} - -// Returns number of chars used. Max possible is 4. -// This algorithm was coded from the table at -// http://en.wikipedia.org/w/index.php?title=UTF-8&oldid=153391259 -// There are no endian issues. -static int UTF32ToUTF8(uint32 incode, unsigned char* out) { - if (incode <= 0x7f) { - out[0] = incode; - return 1; - } - if (incode <= 0x7ff) { - out[0] = 0xC0; - out[0] |= (incode >> 6); - out[1] = 0x80; - out[1] |= (incode & 0x3F); - return 2; - } - if (incode <= 0xFFFF) { - if ((incode > 0xD7FF) && (incode < 0xE000)) - return 0; - out[0] = 0xE0; - out[0] |= (incode >> 12); - out[1] = 0x80; - out[1] |= (incode >> 6) & 0x3F; - out[2] = 0x80; - out[2] |= incode & 0x3F; - return 3; - } - if (incode <= 0x10FFFF) { - out[0] = 0xF0; - out[0] |= incode >> 18; - out[1] = 0x80; - out[1] |= (incode >> 12) & 0x3F; - out[2] = 0x80; - out[2] |= (incode >> 6) & 0x3F; - out[3] = 0x80; - out[3] |= incode & 0x3F; - return 4; - } - return 0; -} - TEST(Syncable, ComparePathNames) { struct { char a; @@ -1124,7 +1076,7 @@ TEST(Syncable, ComparePathNames) { { 'B', 'a', 1 }, { 'b', 'A', 1 }, { 'b', 'a', 1 } }; - for (int i = 0; i < ARRAYSIZE(tests); ++i) { + for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { PathString a(1, tests[i].a); PathString b(1, tests[i].b); const int result = ComparePathNames(a, b); @@ -1134,348 +1086,6 @@ TEST(Syncable, ComparePathNames) { << tests[i].expected_result; } } - -#ifndef OS_WIN - // This table lists (to the best of my knowledge) every pair of characters - // in unicode such that: - // for all i: tolower(kUpperToLowerMap[i].upper) = kUpperToLowerMap[i].lower - // This is then used to test that case-insensitive comparison of each pair - // returns 0 (that, that they are equal). After running the test on Mac OS X - // with the CFString API for comparision, the failing cases were commented - // out. - // - // Map of upper to lower case characters taken from - // ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt - typedef struct { - uint32 upper; // the upper case character - uint32 lower; // the lower case character that upper maps to - } UpperToLowerMapEntry; - static const UpperToLowerMapEntry kUpperToLowerMap[] = { - // { UPPER, lower }, { UPPER, lower }, etc... - // some of these are commented out because they fail on some OS. - { 0x00041, 0x00061 }, { 0x00042, 0x00062 }, { 0x00043, 0x00063 }, - { 0x00044, 0x00064 }, { 0x00045, 0x00065 }, { 0x00046, 0x00066 }, - { 0x00047, 0x00067 }, { 0x00048, 0x00068 }, { 0x00049, 0x00069 }, - { 0x0004A, 0x0006A }, { 0x0004B, 0x0006B }, { 0x0004C, 0x0006C }, - { 0x0004D, 0x0006D }, { 0x0004E, 0x0006E }, { 0x0004F, 0x0006F }, - { 0x00050, 0x00070 }, { 0x00051, 0x00071 }, { 0x00052, 0x00072 }, - { 0x00053, 0x00073 }, { 0x00054, 0x00074 }, { 0x00055, 0x00075 }, - { 0x00056, 0x00076 }, { 0x00057, 0x00077 }, { 0x00058, 0x00078 }, - { 0x00059, 0x00079 }, { 0x0005A, 0x0007A }, { 0x000C0, 0x000E0 }, - { 0x000C1, 0x000E1 }, { 0x000C2, 0x000E2 }, { 0x000C3, 0x000E3 }, - { 0x000C4, 0x000E4 }, { 0x000C5, 0x000E5 }, { 0x000C6, 0x000E6 }, - { 0x000C7, 0x000E7 }, { 0x000C8, 0x000E8 }, { 0x000C9, 0x000E9 }, - { 0x000CA, 0x000EA }, { 0x000CB, 0x000EB }, { 0x000CC, 0x000EC }, - { 0x000CD, 0x000ED }, { 0x000CE, 0x000EE }, { 0x000CF, 0x000EF }, - { 0x000D0, 0x000F0 }, { 0x000D1, 0x000F1 }, { 0x000D2, 0x000F2 }, - { 0x000D3, 0x000F3 }, { 0x000D4, 0x000F4 }, { 0x000D5, 0x000F5 }, - { 0x000D6, 0x000F6 }, { 0x000D8, 0x000F8 }, { 0x000D9, 0x000F9 }, - { 0x000DA, 0x000FA }, { 0x000DB, 0x000FB }, { 0x000DC, 0x000FC }, - { 0x000DD, 0x000FD }, { 0x000DE, 0x000FE }, - { 0x00100, 0x00101 }, { 0x00102, 0x00103 }, { 0x00104, 0x00105 }, - { 0x00106, 0x00107 }, { 0x00108, 0x00109 }, { 0x0010A, 0x0010B }, - { 0x0010C, 0x0010D }, { 0x0010E, 0x0010F }, { 0x00110, 0x00111 }, - { 0x00112, 0x00113 }, { 0x00114, 0x00115 }, { 0x00116, 0x00117 }, - { 0x00118, 0x00119 }, { 0x0011A, 0x0011B }, { 0x0011C, 0x0011D }, - { 0x0011E, 0x0011F }, { 0x00120, 0x00121 }, { 0x00122, 0x00123 }, - { 0x00124, 0x00125 }, { 0x00126, 0x00127 }, { 0x00128, 0x00129 }, - { 0x0012A, 0x0012B }, { 0x0012C, 0x0012D }, { 0x0012E, 0x0012F }, - /*{ 0x00130, 0x00069 },*/ { 0x00132, 0x00133 }, { 0x00134, 0x00135 }, - { 0x00136, 0x00137 }, { 0x00139, 0x0013A }, { 0x0013B, 0x0013C }, - { 0x0013D, 0x0013E }, { 0x0013F, 0x00140 }, { 0x00141, 0x00142 }, - { 0x00143, 0x00144 }, { 0x00145, 0x00146 }, { 0x00147, 0x00148 }, - { 0x0014A, 0x0014B }, { 0x0014C, 0x0014D }, { 0x0014E, 0x0014F }, - { 0x00150, 0x00151 }, { 0x00152, 0x00153 }, { 0x00154, 0x00155 }, - { 0x00156, 0x00157 }, { 0x00158, 0x00159 }, { 0x0015A, 0x0015B }, - { 0x0015C, 0x0015D }, { 0x0015E, 0x0015F }, { 0x00160, 0x00161 }, - { 0x00162, 0x00163 }, { 0x00164, 0x00165 }, { 0x00166, 0x00167 }, - { 0x00168, 0x00169 }, { 0x0016A, 0x0016B }, { 0x0016C, 0x0016D }, - { 0x0016E, 0x0016F }, { 0x00170, 0x00171 }, { 0x00172, 0x00173 }, - { 0x00174, 0x00175 }, { 0x00176, 0x00177 }, { 0x00178, 0x000FF }, - { 0x00179, 0x0017A }, { 0x0017B, 0x0017C }, { 0x0017D, 0x0017E }, - { 0x00181, 0x00253 }, { 0x00182, 0x00183 }, { 0x00184, 0x00185 }, - { 0x00186, 0x00254 }, { 0x00187, 0x00188 }, { 0x00189, 0x00256 }, - { 0x0018A, 0x00257 }, { 0x0018B, 0x0018C }, { 0x0018E, 0x001DD }, - { 0x0018F, 0x00259 }, { 0x00190, 0x0025B }, { 0x00191, 0x00192 }, - { 0x00193, 0x00260 }, { 0x00194, 0x00263 }, { 0x00196, 0x00269 }, - { 0x00197, 0x00268 }, { 0x00198, 0x00199 }, { 0x0019C, 0x0026F }, - { 0x0019D, 0x00272 }, { 0x0019F, 0x00275 }, { 0x001A0, 0x001A1 }, - { 0x001A2, 0x001A3 }, { 0x001A4, 0x001A5 }, { 0x001A6, 0x00280 }, - { 0x001A7, 0x001A8 }, { 0x001A9, 0x00283 }, { 0x001AC, 0x001AD }, - { 0x001AE, 0x00288 }, { 0x001AF, 0x001B0 }, { 0x001B1, 0x0028A }, - { 0x001B2, 0x0028B }, { 0x001B3, 0x001B4 }, { 0x001B5, 0x001B6 }, - { 0x001B7, 0x00292 }, { 0x001B8, 0x001B9 }, { 0x001BC, 0x001BD }, - { 0x001C4, 0x001C6 }, { 0x001C7, 0x001C9 }, { 0x001CA, 0x001CC }, - { 0x001CD, 0x001CE }, { 0x001CF, 0x001D0 }, { 0x001D1, 0x001D2 }, - { 0x001D3, 0x001D4 }, { 0x001D5, 0x001D6 }, { 0x001D7, 0x001D8 }, - { 0x001D9, 0x001DA }, { 0x001DB, 0x001DC }, { 0x001DE, 0x001DF }, - { 0x001E0, 0x001E1 }, { 0x001E2, 0x001E3 }, { 0x001E4, 0x001E5 }, - { 0x001E6, 0x001E7 }, { 0x001E8, 0x001E9 }, { 0x001EA, 0x001EB }, - { 0x001EC, 0x001ED }, { 0x001EE, 0x001EF }, { 0x001F1, 0x001F3 }, - { 0x001F4, 0x001F5 }, { 0x001F6, 0x00195 }, { 0x001F7, 0x001BF }, - { 0x001F8, 0x001F9 }, { 0x001FA, 0x001FB }, { 0x001FC, 0x001FD }, - { 0x001FE, 0x001FF }, { 0x00200, 0x00201 }, { 0x00202, 0x00203 }, - { 0x00204, 0x00205 }, { 0x00206, 0x00207 }, { 0x00208, 0x00209 }, - { 0x0020A, 0x0020B }, { 0x0020C, 0x0020D }, { 0x0020E, 0x0020F }, - { 0x00210, 0x00211 }, { 0x00212, 0x00213 }, { 0x00214, 0x00215 }, - { 0x00216, 0x00217 }, { 0x00218, 0x00219 }, { 0x0021A, 0x0021B }, - { 0x0021C, 0x0021D }, { 0x0021E, 0x0021F }, { 0x00220, 0x0019E }, - { 0x00222, 0x00223 }, { 0x00224, 0x00225 }, { 0x00226, 0x00227 }, - { 0x00228, 0x00229 }, { 0x0022A, 0x0022B }, { 0x0022C, 0x0022D }, - { 0x0022E, 0x0022F }, { 0x00230, 0x00231 }, { 0x00232, 0x00233 }, - /*{ 0x0023B, 0x0023C }, { 0x0023D, 0x0019A }, { 0x00241, 0x00294 }, */ - { 0x00386, 0x003AC }, { 0x00388, 0x003AD }, { 0x00389, 0x003AE }, - { 0x0038A, 0x003AF }, { 0x0038C, 0x003CC }, { 0x0038E, 0x003CD }, - { 0x0038F, 0x003CE }, { 0x00391, 0x003B1 }, { 0x00392, 0x003B2 }, - { 0x00393, 0x003B3 }, { 0x00394, 0x003B4 }, { 0x00395, 0x003B5 }, - { 0x00396, 0x003B6 }, { 0x00397, 0x003B7 }, { 0x00398, 0x003B8 }, - { 0x00399, 0x003B9 }, { 0x0039A, 0x003BA }, { 0x0039B, 0x003BB }, - { 0x0039C, 0x003BC }, { 0x0039D, 0x003BD }, { 0x0039E, 0x003BE }, - { 0x0039F, 0x003BF }, { 0x003A0, 0x003C0 }, { 0x003A1, 0x003C1 }, - { 0x003A3, 0x003C3 }, { 0x003A4, 0x003C4 }, { 0x003A5, 0x003C5 }, - { 0x003A6, 0x003C6 }, { 0x003A7, 0x003C7 }, { 0x003A8, 0x003C8 }, - { 0x003A9, 0x003C9 }, { 0x003AA, 0x003CA }, { 0x003AB, 0x003CB }, - { 0x003D8, 0x003D9 }, { 0x003DA, 0x003DB }, { 0x003DC, 0x003DD }, - { 0x003DE, 0x003DF }, { 0x003E0, 0x003E1 }, { 0x003E2, 0x003E3 }, - { 0x003E4, 0x003E5 }, { 0x003E6, 0x003E7 }, { 0x003E8, 0x003E9 }, - { 0x003EA, 0x003EB }, { 0x003EC, 0x003ED }, { 0x003EE, 0x003EF }, - { 0x003F4, 0x003B8 }, { 0x003F7, 0x003F8 }, { 0x003F9, 0x003F2 }, - { 0x003FA, 0x003FB }, { 0x00400, 0x00450 }, { 0x00401, 0x00451 }, - { 0x00402, 0x00452 }, { 0x00403, 0x00453 }, { 0x00404, 0x00454 }, - { 0x00405, 0x00455 }, { 0x00406, 0x00456 }, { 0x00407, 0x00457 }, - { 0x00408, 0x00458 }, { 0x00409, 0x00459 }, { 0x0040A, 0x0045A }, - { 0x0040B, 0x0045B }, { 0x0040C, 0x0045C }, { 0x0040D, 0x0045D }, - { 0x0040E, 0x0045E }, { 0x0040F, 0x0045F }, { 0x00410, 0x00430 }, - { 0x00411, 0x00431 }, { 0x00412, 0x00432 }, { 0x00413, 0x00433 }, - { 0x00414, 0x00434 }, { 0x00415, 0x00435 }, { 0x00416, 0x00436 }, - { 0x00417, 0x00437 }, { 0x00418, 0x00438 }, { 0x00419, 0x00439 }, - { 0x0041A, 0x0043A }, { 0x0041B, 0x0043B }, { 0x0041C, 0x0043C }, - { 0x0041D, 0x0043D }, { 0x0041E, 0x0043E }, { 0x0041F, 0x0043F }, - { 0x00420, 0x00440 }, { 0x00421, 0x00441 }, { 0x00422, 0x00442 }, - { 0x00423, 0x00443 }, { 0x00424, 0x00444 }, { 0x00425, 0x00445 }, - { 0x00426, 0x00446 }, { 0x00427, 0x00447 }, { 0x00428, 0x00448 }, - { 0x00429, 0x00449 }, { 0x0042A, 0x0044A }, { 0x0042B, 0x0044B }, - { 0x0042C, 0x0044C }, { 0x0042D, 0x0044D }, { 0x0042E, 0x0044E }, - { 0x0042F, 0x0044F }, { 0x00460, 0x00461 }, { 0x00462, 0x00463 }, - { 0x00464, 0x00465 }, { 0x00466, 0x00467 }, { 0x00468, 0x00469 }, - { 0x0046A, 0x0046B }, { 0x0046C, 0x0046D }, { 0x0046E, 0x0046F }, - { 0x00470, 0x00471 }, { 0x00472, 0x00473 }, { 0x00474, 0x00475 }, - { 0x00476, 0x00477 }, { 0x00478, 0x00479 }, { 0x0047A, 0x0047B }, - { 0x0047C, 0x0047D }, { 0x0047E, 0x0047F }, { 0x00480, 0x00481 }, - { 0x0048A, 0x0048B }, { 0x0048C, 0x0048D }, { 0x0048E, 0x0048F }, - { 0x00490, 0x00491 }, { 0x00492, 0x00493 }, { 0x00494, 0x00495 }, - { 0x00496, 0x00497 }, { 0x00498, 0x00499 }, { 0x0049A, 0x0049B }, - { 0x0049C, 0x0049D }, { 0x0049E, 0x0049F }, { 0x004A0, 0x004A1 }, - { 0x004A2, 0x004A3 }, { 0x004A4, 0x004A5 }, { 0x004A6, 0x004A7 }, - { 0x004A8, 0x004A9 }, { 0x004AA, 0x004AB }, { 0x004AC, 0x004AD }, - { 0x004AE, 0x004AF }, { 0x004B0, 0x004B1 }, { 0x004B2, 0x004B3 }, - { 0x004B4, 0x004B5 }, { 0x004B6, 0x004B7 }, { 0x004B8, 0x004B9 }, - { 0x004BA, 0x004BB }, { 0x004BC, 0x004BD }, { 0x004BE, 0x004BF }, - { 0x004C1, 0x004C2 }, { 0x004C3, 0x004C4 }, { 0x004C5, 0x004C6 }, - { 0x004C7, 0x004C8 }, { 0x004C9, 0x004CA }, { 0x004CB, 0x004CC }, - { 0x004CD, 0x004CE }, { 0x004D0, 0x004D1 }, { 0x004D2, 0x004D3 }, - { 0x004D4, 0x004D5 }, { 0x004D6, 0x004D7 }, { 0x004D8, 0x004D9 }, - { 0x004DA, 0x004DB }, { 0x004DC, 0x004DD }, { 0x004DE, 0x004DF }, - { 0x004E0, 0x004E1 }, { 0x004E2, 0x004E3 }, { 0x004E4, 0x004E5 }, - { 0x004E6, 0x004E7 }, { 0x004E8, 0x004E9 }, { 0x004EA, 0x004EB }, - { 0x004EC, 0x004ED }, { 0x004EE, 0x004EF }, { 0x004F0, 0x004F1 }, - { 0x004F2, 0x004F3 }, { 0x004F4, 0x004F5 }, /*{ 0x004F6, 0x004F7 }, */ - { 0x004F8, 0x004F9 }, { 0x00500, 0x00501 }, { 0x00502, 0x00503 }, - { 0x00504, 0x00505 }, { 0x00506, 0x00507 }, { 0x00508, 0x00509 }, - { 0x0050A, 0x0050B }, { 0x0050C, 0x0050D }, { 0x0050E, 0x0050F }, - { 0x00531, 0x00561 }, { 0x00532, 0x00562 }, { 0x00533, 0x00563 }, - { 0x00534, 0x00564 }, { 0x00535, 0x00565 }, { 0x00536, 0x00566 }, - { 0x00537, 0x00567 }, { 0x00538, 0x00568 }, { 0x00539, 0x00569 }, - { 0x0053A, 0x0056A }, { 0x0053B, 0x0056B }, { 0x0053C, 0x0056C }, - { 0x0053D, 0x0056D }, { 0x0053E, 0x0056E }, { 0x0053F, 0x0056F }, - { 0x00540, 0x00570 }, { 0x00541, 0x00571 }, { 0x00542, 0x00572 }, - { 0x00543, 0x00573 }, { 0x00544, 0x00574 }, { 0x00545, 0x00575 }, - { 0x00546, 0x00576 }, { 0x00547, 0x00577 }, { 0x00548, 0x00578 }, - { 0x00549, 0x00579 }, { 0x0054A, 0x0057A }, { 0x0054B, 0x0057B }, - { 0x0054C, 0x0057C }, { 0x0054D, 0x0057D }, { 0x0054E, 0x0057E }, - { 0x0054F, 0x0057F }, { 0x00550, 0x00580 }, { 0x00551, 0x00581 }, - { 0x00552, 0x00582 }, { 0x00553, 0x00583 }, { 0x00554, 0x00584 }, - { 0x00555, 0x00585 }, { 0x00556, 0x00586 }, /*{ 0x010A0, 0x02D00 }, - { 0x010A1, 0x02D01 }, { 0x010A2, 0x02D02 }, { 0x010A3, 0x02D03 }, - { 0x010A4, 0x02D04 }, { 0x010A5, 0x02D05 }, { 0x010A6, 0x02D06 }, - { 0x010A7, 0x02D07 }, { 0x010A8, 0x02D08 }, { 0x010A9, 0x02D09 }, - { 0x010AA, 0x02D0A }, { 0x010AB, 0x02D0B }, { 0x010AC, 0x02D0C }, - { 0x010AD, 0x02D0D }, { 0x010AE, 0x02D0E }, { 0x010AF, 0x02D0F }, - { 0x010B0, 0x02D10 }, { 0x010B1, 0x02D11 }, { 0x010B2, 0x02D12 }, - { 0x010B3, 0x02D13 }, { 0x010B4, 0x02D14 }, { 0x010B5, 0x02D15 }, - { 0x010B6, 0x02D16 }, { 0x010B7, 0x02D17 }, { 0x010B8, 0x02D18 }, - { 0x010B9, 0x02D19 }, { 0x010BA, 0x02D1A }, { 0x010BB, 0x02D1B }, - { 0x010BC, 0x02D1C }, { 0x010BD, 0x02D1D }, { 0x010BE, 0x02D1E }, - { 0x010BF, 0x02D1F }, { 0x010C0, 0x02D20 }, { 0x010C1, 0x02D21 }, - { 0x010C2, 0x02D22 }, { 0x010C3, 0x02D23 }, { 0x010C4, 0x02D24 }, - { 0x010C5, 0x02D25 },*/ { 0x01E00, 0x01E01 }, { 0x01E02, 0x01E03 }, - { 0x01E04, 0x01E05 }, { 0x01E06, 0x01E07 }, { 0x01E08, 0x01E09 }, - { 0x01E0A, 0x01E0B }, { 0x01E0C, 0x01E0D }, { 0x01E0E, 0x01E0F }, - { 0x01E10, 0x01E11 }, { 0x01E12, 0x01E13 }, { 0x01E14, 0x01E15 }, - { 0x01E16, 0x01E17 }, { 0x01E18, 0x01E19 }, { 0x01E1A, 0x01E1B }, - { 0x01E1C, 0x01E1D }, { 0x01E1E, 0x01E1F }, { 0x01E20, 0x01E21 }, - { 0x01E22, 0x01E23 }, { 0x01E24, 0x01E25 }, { 0x01E26, 0x01E27 }, - { 0x01E28, 0x01E29 }, { 0x01E2A, 0x01E2B }, { 0x01E2C, 0x01E2D }, - { 0x01E2E, 0x01E2F }, { 0x01E30, 0x01E31 }, { 0x01E32, 0x01E33 }, - { 0x01E34, 0x01E35 }, { 0x01E36, 0x01E37 }, { 0x01E38, 0x01E39 }, - { 0x01E3A, 0x01E3B }, { 0x01E3C, 0x01E3D }, { 0x01E3E, 0x01E3F }, - { 0x01E40, 0x01E41 }, { 0x01E42, 0x01E43 }, { 0x01E44, 0x01E45 }, - { 0x01E46, 0x01E47 }, { 0x01E48, 0x01E49 }, { 0x01E4A, 0x01E4B }, - { 0x01E4C, 0x01E4D }, { 0x01E4E, 0x01E4F }, { 0x01E50, 0x01E51 }, - { 0x01E52, 0x01E53 }, { 0x01E54, 0x01E55 }, { 0x01E56, 0x01E57 }, - { 0x01E58, 0x01E59 }, { 0x01E5A, 0x01E5B }, { 0x01E5C, 0x01E5D }, - { 0x01E5E, 0x01E5F }, { 0x01E60, 0x01E61 }, { 0x01E62, 0x01E63 }, - { 0x01E64, 0x01E65 }, { 0x01E66, 0x01E67 }, { 0x01E68, 0x01E69 }, - { 0x01E6A, 0x01E6B }, { 0x01E6C, 0x01E6D }, { 0x01E6E, 0x01E6F }, - { 0x01E70, 0x01E71 }, { 0x01E72, 0x01E73 }, { 0x01E74, 0x01E75 }, - { 0x01E76, 0x01E77 }, { 0x01E78, 0x01E79 }, { 0x01E7A, 0x01E7B }, - { 0x01E7C, 0x01E7D }, { 0x01E7E, 0x01E7F }, { 0x01E80, 0x01E81 }, - { 0x01E82, 0x01E83 }, { 0x01E84, 0x01E85 }, { 0x01E86, 0x01E87 }, - { 0x01E88, 0x01E89 }, { 0x01E8A, 0x01E8B }, { 0x01E8C, 0x01E8D }, - { 0x01E8E, 0x01E8F }, { 0x01E90, 0x01E91 }, { 0x01E92, 0x01E93 }, - { 0x01E94, 0x01E95 }, { 0x01EA0, 0x01EA1 }, { 0x01EA2, 0x01EA3 }, - { 0x01EA4, 0x01EA5 }, { 0x01EA6, 0x01EA7 }, { 0x01EA8, 0x01EA9 }, - { 0x01EAA, 0x01EAB }, { 0x01EAC, 0x01EAD }, { 0x01EAE, 0x01EAF }, - { 0x01EB0, 0x01EB1 }, { 0x01EB2, 0x01EB3 }, { 0x01EB4, 0x01EB5 }, - { 0x01EB6, 0x01EB7 }, { 0x01EB8, 0x01EB9 }, { 0x01EBA, 0x01EBB }, - { 0x01EBC, 0x01EBD }, { 0x01EBE, 0x01EBF }, { 0x01EC0, 0x01EC1 }, - { 0x01EC2, 0x01EC3 }, { 0x01EC4, 0x01EC5 }, { 0x01EC6, 0x01EC7 }, - { 0x01EC8, 0x01EC9 }, { 0x01ECA, 0x01ECB }, { 0x01ECC, 0x01ECD }, - { 0x01ECE, 0x01ECF }, { 0x01ED0, 0x01ED1 }, { 0x01ED2, 0x01ED3 }, - { 0x01ED4, 0x01ED5 }, { 0x01ED6, 0x01ED7 }, { 0x01ED8, 0x01ED9 }, - { 0x01EDA, 0x01EDB }, { 0x01EDC, 0x01EDD }, { 0x01EDE, 0x01EDF }, - { 0x01EE0, 0x01EE1 }, { 0x01EE2, 0x01EE3 }, { 0x01EE4, 0x01EE5 }, - { 0x01EE6, 0x01EE7 }, { 0x01EE8, 0x01EE9 }, { 0x01EEA, 0x01EEB }, - { 0x01EEC, 0x01EED }, { 0x01EEE, 0x01EEF }, { 0x01EF0, 0x01EF1 }, - { 0x01EF2, 0x01EF3 }, { 0x01EF4, 0x01EF5 }, { 0x01EF6, 0x01EF7 }, - { 0x01EF8, 0x01EF9 }, { 0x01F08, 0x01F00 }, { 0x01F09, 0x01F01 }, - { 0x01F0A, 0x01F02 }, { 0x01F0B, 0x01F03 }, { 0x01F0C, 0x01F04 }, - { 0x01F0D, 0x01F05 }, { 0x01F0E, 0x01F06 }, { 0x01F0F, 0x01F07 }, - { 0x01F18, 0x01F10 }, { 0x01F19, 0x01F11 }, { 0x01F1A, 0x01F12 }, - { 0x01F1B, 0x01F13 }, { 0x01F1C, 0x01F14 }, { 0x01F1D, 0x01F15 }, - { 0x01F28, 0x01F20 }, { 0x01F29, 0x01F21 }, { 0x01F2A, 0x01F22 }, - { 0x01F2B, 0x01F23 }, { 0x01F2C, 0x01F24 }, { 0x01F2D, 0x01F25 }, - { 0x01F2E, 0x01F26 }, { 0x01F2F, 0x01F27 }, { 0x01F38, 0x01F30 }, - { 0x01F39, 0x01F31 }, { 0x01F3A, 0x01F32 }, { 0x01F3B, 0x01F33 }, - { 0x01F3C, 0x01F34 }, { 0x01F3D, 0x01F35 }, { 0x01F3E, 0x01F36 }, - { 0x01F3F, 0x01F37 }, { 0x01F48, 0x01F40 }, { 0x01F49, 0x01F41 }, - { 0x01F4A, 0x01F42 }, { 0x01F4B, 0x01F43 }, { 0x01F4C, 0x01F44 }, - { 0x01F4D, 0x01F45 }, { 0x01F59, 0x01F51 }, { 0x01F5B, 0x01F53 }, - { 0x01F5D, 0x01F55 }, { 0x01F5F, 0x01F57 }, { 0x01F68, 0x01F60 }, - { 0x01F69, 0x01F61 }, { 0x01F6A, 0x01F62 }, { 0x01F6B, 0x01F63 }, - { 0x01F6C, 0x01F64 }, { 0x01F6D, 0x01F65 }, { 0x01F6E, 0x01F66 }, - { 0x01F6F, 0x01F67 }, { 0x01F88, 0x01F80 }, { 0x01F89, 0x01F81 }, - { 0x01F8A, 0x01F82 }, { 0x01F8B, 0x01F83 }, { 0x01F8C, 0x01F84 }, - { 0x01F8D, 0x01F85 }, { 0x01F8E, 0x01F86 }, { 0x01F8F, 0x01F87 }, - { 0x01F98, 0x01F90 }, { 0x01F99, 0x01F91 }, { 0x01F9A, 0x01F92 }, - { 0x01F9B, 0x01F93 }, { 0x01F9C, 0x01F94 }, { 0x01F9D, 0x01F95 }, - { 0x01F9E, 0x01F96 }, { 0x01F9F, 0x01F97 }, { 0x01FA8, 0x01FA0 }, - { 0x01FA9, 0x01FA1 }, { 0x01FAA, 0x01FA2 }, { 0x01FAB, 0x01FA3 }, - { 0x01FAC, 0x01FA4 }, { 0x01FAD, 0x01FA5 }, { 0x01FAE, 0x01FA6 }, - { 0x01FAF, 0x01FA7 }, { 0x01FB8, 0x01FB0 }, { 0x01FB9, 0x01FB1 }, - { 0x01FBA, 0x01F70 }, { 0x01FBB, 0x01F71 }, { 0x01FBC, 0x01FB3 }, - { 0x01FC8, 0x01F72 }, { 0x01FC9, 0x01F73 }, { 0x01FCA, 0x01F74 }, - { 0x01FCB, 0x01F75 }, { 0x01FCC, 0x01FC3 }, { 0x01FD8, 0x01FD0 }, - { 0x01FD9, 0x01FD1 }, { 0x01FDA, 0x01F76 }, { 0x01FDB, 0x01F77 }, - { 0x01FE8, 0x01FE0 }, { 0x01FE9, 0x01FE1 }, { 0x01FEA, 0x01F7A }, - { 0x01FEB, 0x01F7B }, { 0x01FEC, 0x01FE5 }, { 0x01FF8, 0x01F78 }, - { 0x01FF9, 0x01F79 }, { 0x01FFA, 0x01F7C }, { 0x01FFB, 0x01F7D }, - { 0x01FFC, 0x01FF3 }, { 0x02126, 0x003C9 }, { 0x0212A, 0x0006B }, - { 0x0212B, 0x000E5 }, { 0x02160, 0x02170 }, { 0x02161, 0x02171 }, - { 0x02162, 0x02172 }, { 0x02163, 0x02173 }, { 0x02164, 0x02174 }, - { 0x02165, 0x02175 }, { 0x02166, 0x02176 }, { 0x02167, 0x02177 }, - { 0x02168, 0x02178 }, { 0x02169, 0x02179 }, { 0x0216A, 0x0217A }, - { 0x0216B, 0x0217B }, { 0x0216C, 0x0217C }, { 0x0216D, 0x0217D }, - { 0x0216E, 0x0217E }, { 0x0216F, 0x0217F }, { 0x024B6, 0x024D0 }, - { 0x024B7, 0x024D1 }, { 0x024B8, 0x024D2 }, { 0x024B9, 0x024D3 }, - { 0x024BA, 0x024D4 }, { 0x024BB, 0x024D5 }, { 0x024BC, 0x024D6 }, - { 0x024BD, 0x024D7 }, { 0x024BE, 0x024D8 }, { 0x024BF, 0x024D9 }, - { 0x024C0, 0x024DA }, { 0x024C1, 0x024DB }, { 0x024C2, 0x024DC }, - { 0x024C3, 0x024DD }, { 0x024C4, 0x024DE }, { 0x024C5, 0x024DF }, - { 0x024C6, 0x024E0 }, { 0x024C7, 0x024E1 }, { 0x024C8, 0x024E2 }, - { 0x024C9, 0x024E3 }, { 0x024CA, 0x024E4 }, { 0x024CB, 0x024E5 }, - { 0x024CC, 0x024E6 }, { 0x024CD, 0x024E7 }, { 0x024CE, 0x024E8 }, - { 0x024CF, 0x024E9 }, /*{ 0x02C00, 0x02C30 }, { 0x02C01, 0x02C31 }, - { 0x02C02, 0x02C32 }, { 0x02C03, 0x02C33 }, { 0x02C04, 0x02C34 }, - { 0x02C05, 0x02C35 }, { 0x02C06, 0x02C36 }, { 0x02C07, 0x02C37 }, - { 0x02C08, 0x02C38 }, { 0x02C09, 0x02C39 }, { 0x02C0A, 0x02C3A }, - { 0x02C0B, 0x02C3B }, { 0x02C0C, 0x02C3C }, { 0x02C0D, 0x02C3D }, - { 0x02C0E, 0x02C3E }, { 0x02C0F, 0x02C3F }, { 0x02C10, 0x02C40 }, - { 0x02C11, 0x02C41 }, { 0x02C12, 0x02C42 }, { 0x02C13, 0x02C43 }, - { 0x02C14, 0x02C44 }, { 0x02C15, 0x02C45 }, { 0x02C16, 0x02C46 }, - { 0x02C17, 0x02C47 }, { 0x02C18, 0x02C48 }, { 0x02C19, 0x02C49 }, - { 0x02C1A, 0x02C4A }, { 0x02C1B, 0x02C4B }, { 0x02C1C, 0x02C4C }, - { 0x02C1D, 0x02C4D }, { 0x02C1E, 0x02C4E }, { 0x02C1F, 0x02C4F }, - { 0x02C20, 0x02C50 }, { 0x02C21, 0x02C51 }, { 0x02C22, 0x02C52 }, - { 0x02C23, 0x02C53 }, { 0x02C24, 0x02C54 }, { 0x02C25, 0x02C55 }, - { 0x02C26, 0x02C56 }, { 0x02C27, 0x02C57 }, { 0x02C28, 0x02C58 }, - { 0x02C29, 0x02C59 }, { 0x02C2A, 0x02C5A }, { 0x02C2B, 0x02C5B }, - { 0x02C2C, 0x02C5C }, { 0x02C2D, 0x02C5D }, { 0x02C2E, 0x02C5E }, - { 0x02C80, 0x02C81 }, { 0x02C82, 0x02C83 }, { 0x02C84, 0x02C85 }, - { 0x02C86, 0x02C87 }, { 0x02C88, 0x02C89 }, { 0x02C8A, 0x02C8B }, - { 0x02C8C, 0x02C8D }, { 0x02C8E, 0x02C8F }, { 0x02C90, 0x02C91 }, - { 0x02C92, 0x02C93 }, { 0x02C94, 0x02C95 }, { 0x02C96, 0x02C97 }, - { 0x02C98, 0x02C99 }, { 0x02C9A, 0x02C9B }, { 0x02C9C, 0x02C9D }, - { 0x02C9E, 0x02C9F }, { 0x02CA0, 0x02CA1 }, { 0x02CA2, 0x02CA3 }, - { 0x02CA4, 0x02CA5 }, { 0x02CA6, 0x02CA7 }, { 0x02CA8, 0x02CA9 }, - { 0x02CAA, 0x02CAB }, { 0x02CAC, 0x02CAD }, { 0x02CAE, 0x02CAF }, - { 0x02CB0, 0x02CB1 }, { 0x02CB2, 0x02CB3 }, { 0x02CB4, 0x02CB5 }, - { 0x02CB6, 0x02CB7 }, { 0x02CB8, 0x02CB9 }, { 0x02CBA, 0x02CBB }, - { 0x02CBC, 0x02CBD }, { 0x02CBE, 0x02CBF }, { 0x02CC0, 0x02CC1 }, - { 0x02CC2, 0x02CC3 }, { 0x02CC4, 0x02CC5 }, { 0x02CC6, 0x02CC7 }, - { 0x02CC8, 0x02CC9 }, { 0x02CCA, 0x02CCB }, { 0x02CCC, 0x02CCD }, - { 0x02CCE, 0x02CCF }, { 0x02CD0, 0x02CD1 }, { 0x02CD2, 0x02CD3 }, - { 0x02CD4, 0x02CD5 }, { 0x02CD6, 0x02CD7 }, { 0x02CD8, 0x02CD9 }, - { 0x02CDA, 0x02CDB }, { 0x02CDC, 0x02CDD }, { 0x02CDE, 0x02CDF }, - { 0x02CE0, 0x02CE1 }, { 0x02CE2, 0x02CE3 },*/ { 0x0FF21, 0x0FF41 }, - { 0x0FF22, 0x0FF42 }, { 0x0FF23, 0x0FF43 }, { 0x0FF24, 0x0FF44 }, - { 0x0FF25, 0x0FF45 }, { 0x0FF26, 0x0FF46 }, { 0x0FF27, 0x0FF47 }, - { 0x0FF28, 0x0FF48 }, { 0x0FF29, 0x0FF49 }, { 0x0FF2A, 0x0FF4A }, - { 0x0FF2B, 0x0FF4B }, { 0x0FF2C, 0x0FF4C }, { 0x0FF2D, 0x0FF4D }, - { 0x0FF2E, 0x0FF4E }, { 0x0FF2F, 0x0FF4F }, { 0x0FF30, 0x0FF50 }, - { 0x0FF31, 0x0FF51 }, { 0x0FF32, 0x0FF52 }, { 0x0FF33, 0x0FF53 }, - { 0x0FF34, 0x0FF54 }, { 0x0FF35, 0x0FF55 }, { 0x0FF36, 0x0FF56 }, - { 0x0FF37, 0x0FF57 }, { 0x0FF38, 0x0FF58 }, { 0x0FF39, 0x0FF59 }, - // the following commented out ones fail on OS X 10.5 Leopard - { 0x0FF3A, 0x0FF5A }/*, { 0x10400, 0x10428 }, { 0x10401, 0x10429 }, - { 0x10402, 0x1042A }, { 0x10403, 0x1042B }, { 0x10404, 0x1042C }, - { 0x10405, 0x1042D }, { 0x10406, 0x1042E }, { 0x10407, 0x1042F }, - { 0x10408, 0x10430 }, { 0x10409, 0x10431 }, { 0x1040A, 0x10432 }, - { 0x1040B, 0x10433 }, { 0x1040C, 0x10434 }, { 0x1040D, 0x10435 }, - { 0x1040E, 0x10436 }, { 0x1040F, 0x10437 }, { 0x10410, 0x10438 }, - { 0x10411, 0x10439 }, { 0x10412, 0x1043A }, { 0x10413, 0x1043B }, - { 0x10414, 0x1043C }, { 0x10415, 0x1043D }, { 0x10416, 0x1043E }, - { 0x10417, 0x1043F }, { 0x10418, 0x10440 }, { 0x10419, 0x10441 }, - { 0x1041A, 0x10442 }, { 0x1041B, 0x10443 }, { 0x1041C, 0x10444 }, - { 0x1041D, 0x10445 }, { 0x1041E, 0x10446 }, { 0x1041F, 0x10447 }, - { 0x10420, 0x10448 }, { 0x10421, 0x10449 }, { 0x10422, 0x1044A }, - { 0x10423, 0x1044B }, { 0x10424, 0x1044C }, { 0x10425, 0x1044D }, - { 0x10426, 0x1044E }, { 0x10427, 0x1044F } */ - }; - unsigned char utf8str_upper[5]; - unsigned char utf8str_lower[5]; - for (int i = 0; i < ARRAYSIZE(kUpperToLowerMap); i++) { - int len; - len = UTF32ToUTF8(kUpperToLowerMap[i].upper, utf8str_upper); - CHECK_NE(0, len); - utf8str_upper[len] = '\0'; - len = UTF32ToUTF8(kUpperToLowerMap[i].lower, utf8str_lower); - CHECK_NE(0, len); - utf8str_lower[len] = '\0'; - int result = ComparePathNames( - UTF8ToPathStringQuick(reinterpret_cast<char*>(utf8str_upper)), - UTF8ToPathStringQuick(reinterpret_cast<char*>(utf8str_lower))); - if (0 != result) { - // This ugly strstream works around an issue where using << hex on the - // stream for ADD_FAILURE produces "true" and "false" in the output. - strstream msg; - msg << "ComparePathNames(0x" << hex << kUpperToLowerMap[i].upper - << ", 0x" << hex << kUpperToLowerMap[i].lower - << ") returned " << dec << result << "; expected 0" << '\0'; - ADD_FAILURE() << msg.str(); - } - } -#endif // not defined OS_WIN } #ifdef OS_WIN @@ -1523,7 +1133,7 @@ TEST_F(SyncableDirectoryTest, Bug1509232) { MutableExtendedAttribute ext(&trans, CREATE, key); ASSERT_TRUE(ext.good()); const char value[] = "stuff"; - Blob value_blob(value, value + ARRAYSIZE(value)); + Blob value_blob(value, value + arraysize(value)); ext.mutable_value()->swap(value_blob); ext.delete_attribute(); } diff --git a/chrome/browser/sync/util/highres_timer_unittest.cc b/chrome/browser/sync/util/highres_timer_unittest.cc index 6e9c360..0d3a905 100644 --- a/chrome/browser/sync/util/highres_timer_unittest.cc +++ b/chrome/browser/sync/util/highres_timer_unittest.cc @@ -17,34 +17,34 @@ TEST(HighresTimer, DISABLED_MillisecondClock) { // Note: this could fail if we context switch between initializing the timer // and here. Very unlikely however. - EXPECT_EQ(0, timer.GetElapsedMs()); + EXPECT_TRUE(0 == timer.GetElapsedMs()); timer.Start(); uint64 half_ms = HighresTimer::GetTimerFrequency() / 2000; // Busy wait for half a millisecond. while (timer.start_ticks() + half_ms > HighresTimer::GetCurrentTicks()) { // Nothing } - EXPECT_EQ(1, timer.GetElapsedMs()); + EXPECT_TRUE(1 == timer.GetElapsedMs()); } TEST(HighresTimer, DISABLED_SecondClock) { HighresTimer timer; - EXPECT_EQ(0, timer.GetElapsedSec()); + EXPECT_TRUE(0 == timer.GetElapsedSec()); #ifdef OS_WIN ::Sleep(250); #else struct timespec ts1 = {0, 250000000}; nanosleep(&ts1, 0); #endif - EXPECT_EQ(0, timer.GetElapsedSec()); - EXPECT_LE(230, timer.GetElapsedMs()); - EXPECT_GE(270, timer.GetElapsedMs()); + EXPECT_TRUE(0 == timer.GetElapsedSec()); + EXPECT_TRUE(230 <= timer.GetElapsedMs()); + EXPECT_TRUE(270 >= timer.GetElapsedMs()); #ifdef OS_WIN ::Sleep(251); #else struct timespec ts2 = {0, 251000000}; nanosleep(&ts2, 0); #endif - EXPECT_EQ(1, timer.GetElapsedSec()); + EXPECT_TRUE(1 == timer.GetElapsedSec()); } diff --git a/chrome/browser/sync/util/user_settings_unittest.cc b/chrome/browser/sync/util/user_settings_unittest.cc index 02f1757..d30e04f 100644 --- a/chrome/browser/sync/util/user_settings_unittest.cc +++ b/chrome/browser/sync/util/user_settings_unittest.cc @@ -11,8 +11,8 @@ using browser_sync::UserSettings; -static const wchar_t* kV10UserSettingsDB = L"Version10Settings.sqlite3"; -static const wchar_t* kOldStyleSyncDataDB = L"OldStyleSyncData.sqlite3"; +static const PathChar* kV10UserSettingsDB = PSTR("Version10Settings.sqlite3"); +static const PathChar* kOldStyleSyncDataDB = PSTR("OldStyleSyncData.sqlite3"); class UserSettingsTest : public testing::Test { public: @@ -20,12 +20,13 @@ class UserSettingsTest : public testing::Test { void SetUpVersion10Databases() { CleanUpVersion10Databases(); sqlite3* primer_handle = NULL; - ASSERT_EQ(SQLITE_OK, SqliteOpen(kV10UserSettingsDB, + ASSERT_TRUE(SQLITE_OK == SqliteOpen(kV10UserSettingsDB, &primer_handle)); FilePath old_sync_data(kOldStyleSyncDataDB); - ASSERT_EQ(sync_data_.length(), file_util::WriteFile( - old_sync_data, sync_data_.data(), sync_data_.length())); + ASSERT_TRUE(sync_data_.length() == + static_cast<size_t>(file_util::WriteFile( + old_sync_data, sync_data_.data(), sync_data_.length()))); // Create settings table. ExecOrDie(primer_handle, "CREATE TABLE settings" @@ -39,16 +40,23 @@ class UserSettingsTest : public testing::Test { ExecOrDie(primer_handle, "CREATE TABLE shares" " (email, share_name, file_name," " PRIMARY KEY(email, share_name) ON CONFLICT REPLACE)"); +#if OS_WIN // Populate a share. ExecOrDie(primer_handle, "INSERT INTO shares values ( ?, ?, ?)", "foo@foo.com", "foo@foo.com", WideToUTF8(kOldStyleSyncDataDB)); +#elif OS_LINUX + // Populate a share. + ExecOrDie(primer_handle, "INSERT INTO shares values ( ?, ?, ?)", + "foo@foo.com", "foo@foo.com", kOldStyleSyncDataDB); +#endif sqlite3_close(primer_handle); } void CleanUpVersion10Databases() { ASSERT_TRUE(file_util::DieFileDie(FilePath(kV10UserSettingsDB), false)); ASSERT_TRUE(file_util::DieFileDie(FilePath(kOldStyleSyncDataDB), false)); - ASSERT_TRUE(file_util::DieFileDie(FilePath(L"SyncData.sqlite3"), false)); + ASSERT_TRUE(file_util::DieFileDie(FilePath(PSTR("SyncData.sqlite3")), + false)); } const std::string& sync_data() const { return sync_data_; } @@ -69,18 +77,18 @@ TEST_F(UserSettingsTest, MigrateFromV10ToV11) { // Now poke around using sqlite to see if UserSettings migrated properly. sqlite3* handle = NULL; - ASSERT_EQ(SQLITE_OK, SqliteOpen(kV10UserSettingsDB, &handle)); + ASSERT_TRUE(SQLITE_OK == SqliteOpen(kV10UserSettingsDB, &handle)); ScopedStatement version_query(PrepareQuery(handle, "SELECT version FROM db_version")); - ASSERT_EQ(SQLITE_ROW, sqlite3_step(version_query.get())); + ASSERT_TRUE(SQLITE_ROW == sqlite3_step(version_query.get())); const int version = sqlite3_column_int(version_query.get(), 0); - EXPECT_EQ(11, version); - EXPECT_FALSE(file_util::PathExists(kOldStyleSyncDataDB)); + EXPECT_TRUE(11 == version); + EXPECT_FALSE(file_util::PathExists(FilePath(kOldStyleSyncDataDB))); - std::wstring path(syncable::DirectoryManager::GetSyncDataDatabaseFilename()); + PathString path(syncable::DirectoryManager::GetSyncDataDatabaseFilename()); std::string contents; - ASSERT_TRUE(file_util::ReadFileToString(path, &contents)); - EXPECT_EQ(sync_data(), contents); + ASSERT_TRUE(file_util::ReadFileToString(FilePath(path), &contents)); + EXPECT_TRUE(sync_data() == contents); } diff --git a/chrome/browser/views/sync/sync_setup_wizard_unittest.cc b/chrome/browser/views/sync/sync_setup_wizard_unittest.cc index a6ff71e..4861649 100644 --- a/chrome/browser/views/sync/sync_setup_wizard_unittest.cc +++ b/chrome/browser/views/sync/sync_setup_wizard_unittest.cc @@ -46,7 +46,7 @@ class ProfileSyncServiceForWizardTest : public ProfileSyncService { } virtual string16 GetAuthenticatedUsername() const { - return UTF8ToWide(username_); + return UTF8ToUTF16(username_); } void set_auth_state(const std::string& last_email, AuthErrorState state) { @@ -210,7 +210,7 @@ TEST_F(SyncSetupWizardTest, InitialStepLogin) { EXPECT_EQ(SyncSetupWizard::GAIA_LOGIN, test_window_->flow()->current_state_); dialog_args.Clear(); SyncSetupFlow::GetArgsForGaiaLogin(service_, &dialog_args); - EXPECT_EQ(2, dialog_args.GetSize()); + EXPECT_TRUE(2 == dialog_args.GetSize()); std::string actual_user; dialog_args.GetString(L"user", &actual_user); EXPECT_EQ(kTestUser, actual_user); @@ -342,7 +342,7 @@ TEST_F(SyncSetupWizardTest, DiscreteRun) { wizard_->Step(SyncSetupWizard::GAIA_LOGIN); EXPECT_TRUE(wizard_->IsVisible()); SyncSetupFlow::GetArgsForGaiaLogin(service_, &dialog_args); - EXPECT_EQ(2, dialog_args.GetSize()); + EXPECT_TRUE(2 == dialog_args.GetSize()); std::string actual_user; dialog_args.GetString(L"user", &actual_user); EXPECT_EQ(kTestUser, actual_user); @@ -356,4 +356,3 @@ TEST_F(SyncSetupWizardTest, DiscreteRun) { } #endif // CHROME_PERSONALIZATION - diff --git a/chrome/test/sync/engine/mock_gaia_authenticator.cc b/chrome/test/sync/engine/mock_gaia_authenticator.cc index db188f8..867da59 100644 --- a/chrome/test/sync/engine/mock_gaia_authenticator.cc +++ b/chrome/test/sync/engine/mock_gaia_authenticator.cc @@ -16,7 +16,7 @@ namespace browser_sync { MockGaiaAuthenticator::MockGaiaAuthenticator(const char* user_agent, const char* service_id, const char* gaia_url) : - current_user_(""), should_save_credentials_(false) { + should_save_credentials_(false), current_user_("") { // This discards user_agent, service_id, gaia_url since the mock object // doesn't care about them. } |