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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "chrome/browser/sync/engine/model_changing_syncer_command.h" | 8 #include "chrome/browser/sync/engine/model_changing_syncer_command.h" |
9 #include "chrome/browser/sync/sessions/sync_session.h" | 9 #include "chrome/browser/sync/sessions/sync_session.h" |
10 #include "chrome/browser/sync/syncable/model_type.h" | 10 #include "chrome/browser/sync/syncable/model_type.h" |
11 #include "chrome/browser/sync/test/engine/fake_model_worker.h" | 11 #include "chrome/browser/sync/test/engine/fake_model_worker.h" |
12 #include "chrome/browser/sync/test/engine/syncer_command_test.h" | 12 #include "chrome/browser/sync/test/engine/syncer_command_test.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace browser_sync { | 15 namespace browser_sync { |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 class FakeModelChangingSyncerCommand : public ModelChangingSyncerCommand { | 19 class FakeModelChangingSyncerCommand : public ModelChangingSyncerCommand { |
20 public: | 20 public: |
21 FakeModelChangingSyncerCommand() {} | 21 FakeModelChangingSyncerCommand() {} |
22 virtual ~FakeModelChangingSyncerCommand() {} | 22 virtual ~FakeModelChangingSyncerCommand() {} |
23 | 23 |
24 const std::set<ModelSafeGroup>& changed_groups() const { | 24 const std::set<ModelSafeGroup>& changed_groups() const { |
25 return changed_groups_; | 25 return changed_groups_; |
26 } | 26 } |
27 | 27 |
28 protected: | 28 protected: |
29 virtual bool HasCustomGroupsToChange() const OVERRIDE { | |
30 return false; | |
31 } | |
32 | |
33 virtual std::set<ModelSafeGroup> GetGroupsToChange( | 29 virtual std::set<ModelSafeGroup> GetGroupsToChange( |
34 const sessions::SyncSession& session) const OVERRIDE { | 30 const sessions::SyncSession& session) const OVERRIDE { |
35 return session.GetEnabledGroups(); | 31 return session.GetEnabledGroups(); |
36 } | 32 } |
37 | 33 |
38 virtual void ModelChangingExecuteImpl( | 34 virtual void ModelChangingExecuteImpl( |
39 sessions::SyncSession* session) OVERRIDE { | 35 sessions::SyncSession* session) OVERRIDE { |
40 changed_groups_.insert(session->status_controller().group_restriction()); | 36 changed_groups_.insert(session->status_controller().group_restriction()); |
41 } | 37 } |
42 | 38 |
(...skipping 28 matching lines...) Expand all Loading... |
71 ExpectGroupsToChange(command_, GROUP_UI, GROUP_PASSWORD, GROUP_PASSIVE); | 67 ExpectGroupsToChange(command_, GROUP_UI, GROUP_PASSWORD, GROUP_PASSIVE); |
72 EXPECT_TRUE(command_.changed_groups().empty()); | 68 EXPECT_TRUE(command_.changed_groups().empty()); |
73 command_.ExecuteImpl(session()); | 69 command_.ExecuteImpl(session()); |
74 EXPECT_EQ(command_.GetGroupsToChangeForTest(*session()), | 70 EXPECT_EQ(command_.GetGroupsToChangeForTest(*session()), |
75 command_.changed_groups()); | 71 command_.changed_groups()); |
76 } | 72 } |
77 | 73 |
78 } // namespace | 74 } // namespace |
79 | 75 |
80 } // namespace browser_sync | 76 } // namespace browser_sync |
OLD | NEW |