OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/synchronization/waitable_event.h" | 5 #include "base/synchronization/waitable_event.h" |
6 #include "base/test/test_timeouts.h" | 6 #include "base/test/test_timeouts.h" |
7 #include "chrome/browser/sync/engine/mock_model_safe_workers.h" | 7 #include "chrome/browser/sync/engine/mock_model_safe_workers.h" |
8 #include "chrome/browser/sync/engine/syncer.h" | 8 #include "chrome/browser/sync/engine/syncer.h" |
9 #include "chrome/browser/sync/engine/syncer_thread2.h" | 9 #include "chrome/browser/sync/engine/syncer_thread.h" |
10 #include "chrome/browser/sync/sessions/test_util.h" | 10 #include "chrome/browser/sync/sessions/test_util.h" |
11 #include "chrome/test/sync/engine/mock_connection_manager.h" | 11 #include "chrome/test/sync/engine/mock_connection_manager.h" |
12 #include "chrome/test/sync/engine/test_directory_setter_upper.h" | 12 #include "chrome/test/sync/engine/test_directory_setter_upper.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
15 | 15 |
16 using base::TimeDelta; | 16 using base::TimeDelta; |
17 using base::TimeTicks; | 17 using base::TimeTicks; |
18 using testing::_; | 18 using testing::_; |
19 using testing::AtLeast; | 19 using testing::AtLeast; |
(...skipping 10 matching lines...) Expand all Loading... |
30 using sessions::SyncSessionSnapshot; | 30 using sessions::SyncSessionSnapshot; |
31 using syncable::ModelTypeBitSet; | 31 using syncable::ModelTypeBitSet; |
32 using sync_pb::GetUpdatesCallerInfo; | 32 using sync_pb::GetUpdatesCallerInfo; |
33 | 33 |
34 class MockSyncer : public Syncer { | 34 class MockSyncer : public Syncer { |
35 public: | 35 public: |
36 MOCK_METHOD3(SyncShare, void(sessions::SyncSession*, SyncerStep, | 36 MOCK_METHOD3(SyncShare, void(sessions::SyncSession*, SyncerStep, |
37 SyncerStep)); | 37 SyncerStep)); |
38 }; | 38 }; |
39 | 39 |
40 namespace s3 { | |
41 | |
42 // Used when tests want to record syncing activity to examine later. | 40 // Used when tests want to record syncing activity to examine later. |
43 struct SyncShareRecords { | 41 struct SyncShareRecords { |
44 std::vector<TimeTicks> times; | 42 std::vector<TimeTicks> times; |
45 std::vector<linked_ptr<SyncSessionSnapshot> > snapshots; | 43 std::vector<linked_ptr<SyncSessionSnapshot> > snapshots; |
46 }; | 44 }; |
47 | 45 |
48 // Convenient to use in tests wishing to analyze SyncShare calls over time. | 46 // Convenient to use in tests wishing to analyze SyncShare calls over time. |
49 static const size_t kMinNumSamples = 5; | 47 static const size_t kMinNumSamples = 5; |
50 class SyncerThread2Test : public testing::Test { | 48 class SyncerThread2Test : public testing::Test { |
51 public: | 49 public: |
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 | 920 |
923 syncer_thread()->Start(SyncerThread::NORMAL_MODE, NULL); | 921 syncer_thread()->Start(SyncerThread::NORMAL_MODE, NULL); |
924 syncer_thread()->ScheduleNudge(zero(), NUDGE_SOURCE_LOCAL, ModelTypeBitSet(), | 922 syncer_thread()->ScheduleNudge(zero(), NUDGE_SOURCE_LOCAL, ModelTypeBitSet(), |
925 FROM_HERE); | 923 FROM_HERE); |
926 FlushLastTask(&done); | 924 FlushLastTask(&done); |
927 syncer_thread()->Stop(); | 925 syncer_thread()->Stop(); |
928 | 926 |
929 EXPECT_TRUE(expected == context()->previous_session_routing_info()); | 927 EXPECT_TRUE(expected == context()->previous_session_routing_info()); |
930 } | 928 } |
931 | 929 |
932 } // namespace s3 | |
933 } // namespace browser_sync | 930 } // namespace browser_sync |
934 | 931 |
935 // SyncerThread won't outlive the test! | 932 // SyncerThread won't outlive the test! |
936 DISABLE_RUNNABLE_METHOD_REFCOUNT(browser_sync::s3::SyncerThread2Test); | 933 DISABLE_RUNNABLE_METHOD_REFCOUNT(browser_sync::SyncerThread2Test); |
OLD | NEW |