| 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 "components/sync/engine/model_safe_worker.h" | 5 #include "components/sync/engine/model_safe_worker.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 } // namespace | 84 } // namespace |
| 85 | 85 |
| 86 TEST_F(ModelSafeWorkerTest, ModelSafeRoutingInfoToValue) { | 86 TEST_F(ModelSafeWorkerTest, ModelSafeRoutingInfoToValue) { |
| 87 ModelSafeRoutingInfo routing_info; | 87 ModelSafeRoutingInfo routing_info; |
| 88 routing_info[BOOKMARKS] = GROUP_PASSIVE; | 88 routing_info[BOOKMARKS] = GROUP_PASSIVE; |
| 89 routing_info[NIGORI] = GROUP_UI; | 89 routing_info[NIGORI] = GROUP_UI; |
| 90 routing_info[PREFERENCES] = GROUP_DB; | 90 routing_info[PREFERENCES] = GROUP_DB; |
| 91 routing_info[APPS] = GROUP_NON_BLOCKING; | 91 routing_info[APPS] = GROUP_NON_BLOCKING; |
| 92 base::DictionaryValue expected_value; | 92 base::DictionaryValue expected_value; |
| 93 expected_value.SetString("Apps", "GROUP_NON_BLOCKING"); | 93 expected_value.SetString("Apps", "Group Non Blocking"); |
| 94 expected_value.SetString("Bookmarks", "GROUP_PASSIVE"); | 94 expected_value.SetString("Bookmarks", "Group Passive"); |
| 95 expected_value.SetString("Encryption Keys", "GROUP_UI"); | 95 expected_value.SetString("Encryption Keys", "Group UI"); |
| 96 expected_value.SetString("Preferences", "GROUP_DB"); | 96 expected_value.SetString("Preferences", "Group DB"); |
| 97 std::unique_ptr<base::DictionaryValue> value( | 97 std::unique_ptr<base::DictionaryValue> value( |
| 98 ModelSafeRoutingInfoToValue(routing_info)); | 98 ModelSafeRoutingInfoToValue(routing_info)); |
| 99 EXPECT_TRUE(value->Equals(&expected_value)); | 99 EXPECT_TRUE(value->Equals(&expected_value)); |
| 100 } | 100 } |
| 101 | 101 |
| 102 TEST_F(ModelSafeWorkerTest, ModelSafeRoutingInfoToString) { | 102 TEST_F(ModelSafeWorkerTest, ModelSafeRoutingInfoToString) { |
| 103 ModelSafeRoutingInfo routing_info; | 103 ModelSafeRoutingInfo routing_info; |
| 104 routing_info[APPS] = GROUP_NON_BLOCKING; | 104 routing_info[APPS] = GROUP_NON_BLOCKING; |
| 105 routing_info[BOOKMARKS] = GROUP_PASSIVE; | 105 routing_info[BOOKMARKS] = GROUP_PASSIVE; |
| 106 routing_info[NIGORI] = GROUP_UI; | 106 routing_info[NIGORI] = GROUP_UI; |
| 107 routing_info[PREFERENCES] = GROUP_DB; | 107 routing_info[PREFERENCES] = GROUP_DB; |
| 108 EXPECT_EQ( | 108 EXPECT_EQ( |
| 109 "{\"Apps\":\"GROUP_NON_BLOCKING\",\"Bookmarks\":\"GROUP_PASSIVE\"," | 109 "{\"Apps\":\"Group Non Blocking\",\"Bookmarks\":\"Group Passive\"," |
| 110 "\"Encryption Keys\":\"GROUP_UI\",\"Preferences\":\"GROUP_DB\"}", | 110 "\"Encryption Keys\":\"Group UI\",\"Preferences\":\"Group DB\"}", |
| 111 ModelSafeRoutingInfoToString(routing_info)); | 111 ModelSafeRoutingInfoToString(routing_info)); |
| 112 } | 112 } |
| 113 | 113 |
| 114 TEST_F(ModelSafeWorkerTest, GetRoutingInfoTypes) { | 114 TEST_F(ModelSafeWorkerTest, GetRoutingInfoTypes) { |
| 115 ModelSafeRoutingInfo routing_info; | 115 ModelSafeRoutingInfo routing_info; |
| 116 routing_info[BOOKMARKS] = GROUP_PASSIVE; | 116 routing_info[BOOKMARKS] = GROUP_PASSIVE; |
| 117 routing_info[NIGORI] = GROUP_UI; | 117 routing_info[NIGORI] = GROUP_UI; |
| 118 routing_info[PREFERENCES] = GROUP_DB; | 118 routing_info[PREFERENCES] = GROUP_DB; |
| 119 const ModelTypeSet expected_types(BOOKMARKS, NIGORI, PREFERENCES); | 119 const ModelTypeSet expected_types(BOOKMARKS, NIGORI, PREFERENCES); |
| 120 EXPECT_EQ(expected_types, GetRoutingInfoTypes(routing_info)); | 120 EXPECT_EQ(expected_types, GetRoutingInfoTypes(routing_info)); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 while (!worker_->task_runner()->HasPendingTask()) | 205 while (!worker_->task_runner()->HasPendingTask()) |
| 206 base::PlatformThread::YieldCurrentThread(); | 206 base::PlatformThread::YieldCurrentThread(); |
| 207 worker_->task_runner()->RunUntilIdle(); | 207 worker_->task_runner()->RunUntilIdle(); |
| 208 | 208 |
| 209 EXPECT_TRUE(did_work); | 209 EXPECT_TRUE(did_work); |
| 210 sync_thread_.Stop(); | 210 sync_thread_.Stop(); |
| 211 EXPECT_TRUE(sync_thread_unblocked_.IsSet()); | 211 EXPECT_TRUE(sync_thread_unblocked_.IsSet()); |
| 212 } | 212 } |
| 213 | 213 |
| 214 } // namespace syncer | 214 } // namespace syncer |
| OLD | NEW |