| 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 "sync/internal_api/public/engine/model_safe_worker.h" | 5 #include "sync/internal_api/public/engine/model_safe_worker.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 TEST_F(ModelSafeWorkerTest, GetRoutingInfoTypes) { | 42 TEST_F(ModelSafeWorkerTest, GetRoutingInfoTypes) { |
| 43 ModelSafeRoutingInfo routing_info; | 43 ModelSafeRoutingInfo routing_info; |
| 44 routing_info[BOOKMARKS] = GROUP_PASSIVE; | 44 routing_info[BOOKMARKS] = GROUP_PASSIVE; |
| 45 routing_info[NIGORI] = GROUP_UI; | 45 routing_info[NIGORI] = GROUP_UI; |
| 46 routing_info[PREFERENCES] = GROUP_DB; | 46 routing_info[PREFERENCES] = GROUP_DB; |
| 47 const ModelTypeSet expected_types(BOOKMARKS, NIGORI, PREFERENCES); | 47 const ModelTypeSet expected_types(BOOKMARKS, NIGORI, PREFERENCES); |
| 48 EXPECT_TRUE(GetRoutingInfoTypes(routing_info).Equals(expected_types)); | 48 EXPECT_TRUE(GetRoutingInfoTypes(routing_info).Equals(expected_types)); |
| 49 } | 49 } |
| 50 | 50 |
| 51 TEST_F(ModelSafeWorkerTest, ModelSafeRoutingInfoToPayloadMap) { | 51 TEST_F(ModelSafeWorkerTest, ModelSafeRoutingInfoToStateMap) { |
| 52 std::string payload = "test"; | 52 std::string payload = "test"; |
| 53 ModelSafeRoutingInfo routing_info; | 53 ModelSafeRoutingInfo routing_info; |
| 54 routing_info[BOOKMARKS] = GROUP_PASSIVE; | 54 routing_info[BOOKMARKS] = GROUP_PASSIVE; |
| 55 routing_info[NIGORI] = GROUP_UI; | 55 routing_info[NIGORI] = GROUP_UI; |
| 56 routing_info[PREFERENCES] = GROUP_DB; | 56 routing_info[PREFERENCES] = GROUP_DB; |
| 57 ModelTypePayloadMap types_with_payloads = | 57 ModelTypeStateMap type_state_map = |
| 58 ModelSafeRoutingInfoToPayloadMap(routing_info, payload); | 58 ModelSafeRoutingInfoToStateMap(routing_info, payload); |
| 59 ASSERT_EQ(routing_info.size(), types_with_payloads.size()); | 59 ASSERT_EQ(routing_info.size(), type_state_map.size()); |
| 60 for (ModelSafeRoutingInfo::iterator iter = routing_info.begin(); | 60 for (ModelSafeRoutingInfo::iterator iter = routing_info.begin(); |
| 61 iter != routing_info.end(); | 61 iter != routing_info.end(); |
| 62 ++iter) { | 62 ++iter) { |
| 63 EXPECT_EQ(payload, types_with_payloads[iter->first]); | 63 EXPECT_EQ(payload, type_state_map[iter->first].payload); |
| 64 EXPECT_TRUE(type_state_map[iter->first].ack_handle.empty()); |
| 64 } | 65 } |
| 65 } | 66 } |
| 66 | 67 |
| 67 } // namespace | 68 } // namespace |
| 68 } // namespace syncer | 69 } // namespace syncer |
| OLD | NEW |