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/location.h" | 5 #include "base/location.h" |
6 #include "chrome/browser/sync/engine/verify_updates_command.h" | 6 #include "chrome/browser/sync/engine/verify_updates_command.h" |
7 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" | 7 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" |
8 #include "chrome/browser/sync/sessions/sync_session.h" | 8 #include "chrome/browser/sync/sessions/sync_session.h" |
9 #include "chrome/browser/sync/syncable/directory_manager.h" | 9 #include "chrome/browser/sync/syncable/directory_manager.h" |
10 #include "chrome/browser/sync/engine/mock_model_safe_workers.h" | |
11 #include "chrome/browser/sync/syncable/syncable.h" | 10 #include "chrome/browser/sync/syncable/syncable.h" |
12 #include "chrome/browser/sync/syncable/syncable_id.h" | 11 #include "chrome/browser/sync/syncable/syncable_id.h" |
| 12 #include "chrome/browser/sync/test/engine/fake_model_worker.h" |
13 #include "chrome/browser/sync/test/engine/syncer_command_test.h" | 13 #include "chrome/browser/sync/test/engine/syncer_command_test.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 namespace browser_sync { | 16 namespace browser_sync { |
17 | 17 |
18 using sessions::SyncSession; | 18 using sessions::SyncSession; |
19 using sessions::StatusController; | 19 using sessions::StatusController; |
20 using std::string; | 20 using std::string; |
21 using syncable::Entry; | 21 using syncable::Entry; |
22 using syncable::Id; | 22 using syncable::Id; |
23 using syncable::MutableEntry; | 23 using syncable::MutableEntry; |
24 using syncable::ReadTransaction; | 24 using syncable::ReadTransaction; |
25 using syncable::ScopedDirLookup; | 25 using syncable::ScopedDirLookup; |
26 using syncable::UNITTEST; | 26 using syncable::UNITTEST; |
27 using syncable::WriteTransaction; | 27 using syncable::WriteTransaction; |
28 | 28 |
29 class VerifyUpdatesCommandTest : public SyncerCommandTest { | 29 class VerifyUpdatesCommandTest : public SyncerCommandTest { |
30 public: | 30 public: |
31 virtual void SetUp() { | 31 virtual void SetUp() { |
32 workers()->clear(); | 32 workers()->clear(); |
33 mutable_routing_info()->clear(); | 33 mutable_routing_info()->clear(); |
34 workers()->push_back(make_scoped_refptr(new MockDBModelWorker())); | 34 workers()->push_back(make_scoped_refptr(new FakeModelWorker(GROUP_DB))); |
35 workers()->push_back(make_scoped_refptr(new MockUIModelWorker())); | 35 workers()->push_back(make_scoped_refptr(new FakeModelWorker(GROUP_UI))); |
36 (*mutable_routing_info())[syncable::PREFERENCES] = GROUP_UI; | 36 (*mutable_routing_info())[syncable::PREFERENCES] = GROUP_UI; |
37 (*mutable_routing_info())[syncable::BOOKMARKS] = GROUP_UI; | 37 (*mutable_routing_info())[syncable::BOOKMARKS] = GROUP_UI; |
38 (*mutable_routing_info())[syncable::AUTOFILL] = GROUP_DB; | 38 (*mutable_routing_info())[syncable::AUTOFILL] = GROUP_DB; |
39 SyncerCommandTest::SetUp(); | 39 SyncerCommandTest::SetUp(); |
40 } | 40 } |
41 | 41 |
42 void CreateLocalItem(const std::string& item_id, | 42 void CreateLocalItem(const std::string& item_id, |
43 const std::string& parent_id, | 43 const std::string& parent_id, |
44 const syncable::ModelType& type) { | 44 const syncable::ModelType& type) { |
45 ScopedDirLookup dir(syncdb()->manager(), syncdb()->name()); | 45 ScopedDirLookup dir(syncdb()->manager(), syncdb()->name()); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_DB); | 99 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_DB); |
100 EXPECT_EQ(1, status->update_progress().VerifiedUpdatesSize()); | 100 EXPECT_EQ(1, status->update_progress().VerifiedUpdatesSize()); |
101 } | 101 } |
102 { | 102 { |
103 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_PASSIVE); | 103 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_PASSIVE); |
104 EXPECT_EQ(0, status->update_progress().VerifiedUpdatesSize()); | 104 EXPECT_EQ(0, status->update_progress().VerifiedUpdatesSize()); |
105 } | 105 } |
106 } | 106 } |
107 | 107 |
108 } | 108 } |
OLD | NEW |