Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(867)

Side by Side Diff: sync/internal_api/public/engine/model_safe_worker_unittest.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "sync/internal_api/public/engine/model_safe_worker.h"
6
7 #include <memory>
8
9 #include "base/values.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace syncer {
13 namespace {
14
15 class ModelSafeWorkerTest : public ::testing::Test {
16 };
17
18 TEST_F(ModelSafeWorkerTest, ModelSafeRoutingInfoToValue) {
19 ModelSafeRoutingInfo routing_info;
20 routing_info[BOOKMARKS] = GROUP_PASSIVE;
21 routing_info[NIGORI] = GROUP_UI;
22 routing_info[PREFERENCES] = GROUP_DB;
23 routing_info[APPS] = GROUP_NON_BLOCKING;
24 base::DictionaryValue expected_value;
25 expected_value.SetString("Apps", "GROUP_NON_BLOCKING");
26 expected_value.SetString("Bookmarks", "GROUP_PASSIVE");
27 expected_value.SetString("Encryption keys", "GROUP_UI");
28 expected_value.SetString("Preferences", "GROUP_DB");
29 std::unique_ptr<base::DictionaryValue> value(
30 ModelSafeRoutingInfoToValue(routing_info));
31 EXPECT_TRUE(value->Equals(&expected_value));
32 }
33
34 TEST_F(ModelSafeWorkerTest, ModelSafeRoutingInfoToString) {
35 ModelSafeRoutingInfo routing_info;
36 routing_info[APPS] = GROUP_NON_BLOCKING;
37 routing_info[BOOKMARKS] = GROUP_PASSIVE;
38 routing_info[NIGORI] = GROUP_UI;
39 routing_info[PREFERENCES] = GROUP_DB;
40 EXPECT_EQ(
41 "{\"Apps\":\"GROUP_NON_BLOCKING\",\"Bookmarks\":\"GROUP_PASSIVE\","
42 "\"Encryption keys\":\"GROUP_UI\",\"Preferences\":\"GROUP_DB\"}",
43 ModelSafeRoutingInfoToString(routing_info));
44 }
45
46 TEST_F(ModelSafeWorkerTest, GetRoutingInfoTypes) {
47 ModelSafeRoutingInfo routing_info;
48 routing_info[BOOKMARKS] = GROUP_PASSIVE;
49 routing_info[NIGORI] = GROUP_UI;
50 routing_info[PREFERENCES] = GROUP_DB;
51 const ModelTypeSet expected_types(BOOKMARKS, NIGORI, PREFERENCES);
52 EXPECT_EQ(expected_types, GetRoutingInfoTypes(routing_info));
53 }
54
55 } // namespace
56 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/public/engine/model_safe_worker.cc ('k') | sync/internal_api/public/engine/passive_model_worker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698