| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "chrome/browser/sync/glue/device_info.h" | 10 #include "chrome/browser/sync/glue/device_info.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 scoped_ptr<SyncedDeviceTracker> synced_device_tracker_; | 63 scoped_ptr<SyncedDeviceTracker> synced_device_tracker_; |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 // Count of how many closed WriteTransactions notified of meaningful changes. | 66 // Count of how many closed WriteTransactions notified of meaningful changes. |
| 67 int GetTotalTransactionsCount() { | 67 int GetTotalTransactionsCount() { |
| 68 base::RunLoop run_loop; | 68 base::RunLoop run_loop; |
| 69 run_loop.RunUntilIdle(); | 69 run_loop.RunUntilIdle(); |
| 70 return test_user_share_.transaction_observer()->transactions_observed(); | 70 return test_user_share_.transaction_observer()->transactions_observed(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 MessageLoop message_loop_; | 73 base::MessageLoop message_loop_; |
| 74 syncer::TestUserShare test_user_share_; | 74 syncer::TestUserShare test_user_share_; |
| 75 int transaction_count_baseline_; | 75 int transaction_count_baseline_; |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 namespace { | 78 namespace { |
| 79 | 79 |
| 80 // New client scenario: set device info when no previous info existed. | 80 // New client scenario: set device info when no previous info existed. |
| 81 TEST_F(SyncedDeviceTrackerTest, CreateNewDeviceInfo) { | 81 TEST_F(SyncedDeviceTrackerTest, CreateNewDeviceInfo) { |
| 82 ASSERT_FALSE(synced_device_tracker_->ReadLocalDeviceInfo()); | 82 ASSERT_FALSE(synced_device_tracker_->ReadLocalDeviceInfo()); |
| 83 | 83 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 EXPECT_TRUE(result_device_info->Equals(device_info_v2)); | 152 EXPECT_TRUE(result_device_info->Equals(device_info_v2)); |
| 153 | 153 |
| 154 // The update write should have sent a nudge. | 154 // The update write should have sent a nudge. |
| 155 EXPECT_EQ(1, GetObservedChangesCounter()); | 155 EXPECT_EQ(1, GetObservedChangesCounter()); |
| 156 } | 156 } |
| 157 | 157 |
| 158 } // namespace | 158 } // namespace |
| 159 | 159 |
| 160 } // namespace browser_sync | 160 } // namespace browser_sync |
| OLD | NEW |