| 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 "chrome/browser/sync/sessions/sync_session.h" | 5 #include "chrome/browser/sync/sessions/sync_session.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 *out = routes_; | 101 *out = routes_; |
| 102 } | 102 } |
| 103 | 103 |
| 104 StatusController* status() { return session_->mutable_status_controller(); } | 104 StatusController* status() { return session_->mutable_status_controller(); } |
| 105 protected: | 105 protected: |
| 106 void FailControllerInvocationIfDisabled(const std::string& msg) { | 106 void FailControllerInvocationIfDisabled(const std::string& msg) { |
| 107 if (!controller_invocations_allowed_) | 107 if (!controller_invocations_allowed_) |
| 108 FAIL() << msg; | 108 FAIL() << msg; |
| 109 } | 109 } |
| 110 | 110 |
| 111 syncable::ModelEnumSet ParamsMeaningAllEnabledTypes() { | 111 syncable::ModelTypeSet ParamsMeaningAllEnabledTypes() { |
| 112 syncable::ModelEnumSet request_params( | 112 syncable::ModelTypeSet request_params( |
| 113 syncable::BOOKMARKS, syncable::AUTOFILL); | 113 syncable::BOOKMARKS, syncable::AUTOFILL); |
| 114 return request_params; | 114 return request_params; |
| 115 } | 115 } |
| 116 | 116 |
| 117 syncable::ModelEnumSet ParamsMeaningJustOneEnabledType() { | 117 syncable::ModelTypeSet ParamsMeaningJustOneEnabledType() { |
| 118 return syncable::ModelEnumSet(syncable::AUTOFILL); | 118 return syncable::ModelTypeSet(syncable::AUTOFILL); |
| 119 } | 119 } |
| 120 | 120 |
| 121 MessageLoop message_loop_; | 121 MessageLoop message_loop_; |
| 122 bool controller_invocations_allowed_; | 122 bool controller_invocations_allowed_; |
| 123 scoped_ptr<SyncSession> session_; | 123 scoped_ptr<SyncSession> session_; |
| 124 scoped_ptr<SyncSessionContext> context_; | 124 scoped_ptr<SyncSessionContext> context_; |
| 125 std::vector<scoped_refptr<ModelSafeWorker> > workers_; | 125 std::vector<scoped_refptr<ModelSafeWorker> > workers_; |
| 126 ModelSafeRoutingInfo routes_; | 126 ModelSafeRoutingInfo routes_; |
| 127 }; | 127 }; |
| 128 | 128 |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 EXPECT_NE(it1, second.routing_info().end()); | 530 EXPECT_NE(it1, second.routing_info().end()); |
| 531 EXPECT_EQ(it1->second, GROUP_DB); | 531 EXPECT_EQ(it1->second, GROUP_DB); |
| 532 | 532 |
| 533 EXPECT_NE(it2, second.routing_info().end()); | 533 EXPECT_NE(it2, second.routing_info().end()); |
| 534 EXPECT_EQ(it2->second, GROUP_UI); | 534 EXPECT_EQ(it2->second, GROUP_UI); |
| 535 EXPECT_EQ(second.routing_info().size(), 2U); | 535 EXPECT_EQ(second.routing_info().size(), 2U); |
| 536 } | 536 } |
| 537 | 537 |
| 538 | 538 |
| 539 TEST_F(SyncSessionTest, MakeTypePayloadMapFromBitSet) { | 539 TEST_F(SyncSessionTest, MakeTypePayloadMapFromBitSet) { |
| 540 syncable::ModelEnumSet types; | 540 syncable::ModelTypeSet types; |
| 541 std::string payload = "test"; | 541 std::string payload = "test"; |
| 542 syncable::ModelTypePayloadMap types_with_payloads = | 542 syncable::ModelTypePayloadMap types_with_payloads = |
| 543 syncable::ModelTypePayloadMapFromEnumSet(types, payload); | 543 syncable::ModelTypePayloadMapFromEnumSet(types, payload); |
| 544 EXPECT_TRUE(types_with_payloads.empty()); | 544 EXPECT_TRUE(types_with_payloads.empty()); |
| 545 | 545 |
| 546 types.Put(syncable::BOOKMARKS); | 546 types.Put(syncable::BOOKMARKS); |
| 547 types.Put(syncable::PASSWORDS); | 547 types.Put(syncable::PASSWORDS); |
| 548 types.Put(syncable::AUTOFILL); | 548 types.Put(syncable::AUTOFILL); |
| 549 payload = "test2"; | 549 payload = "test2"; |
| 550 types_with_payloads = | 550 types_with_payloads = |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 EXPECT_EQ(empty_payload, original[syncable::BOOKMARKS]); | 591 EXPECT_EQ(empty_payload, original[syncable::BOOKMARKS]); |
| 592 EXPECT_EQ(payload1, original[syncable::PASSWORDS]); | 592 EXPECT_EQ(payload1, original[syncable::PASSWORDS]); |
| 593 EXPECT_EQ(payload1, original[syncable::AUTOFILL]); | 593 EXPECT_EQ(payload1, original[syncable::AUTOFILL]); |
| 594 EXPECT_EQ(payload2, original[syncable::SESSIONS]); | 594 EXPECT_EQ(payload2, original[syncable::SESSIONS]); |
| 595 EXPECT_EQ(payload3, original[syncable::THEMES]); | 595 EXPECT_EQ(payload3, original[syncable::THEMES]); |
| 596 } | 596 } |
| 597 | 597 |
| 598 } // namespace | 598 } // namespace |
| 599 } // namespace sessions | 599 } // namespace sessions |
| 600 } // namespace browser_sync | 600 } // namespace browser_sync |
| OLD | NEW |