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

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

Issue 1866243002: Convert //sync from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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 <memory>
8
8 #include "base/values.h" 9 #include "base/values.h"
9 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
10 11
11 namespace syncer { 12 namespace syncer {
12 namespace { 13 namespace {
13 14
14 class ModelSafeWorkerTest : public ::testing::Test { 15 class ModelSafeWorkerTest : public ::testing::Test {
15 }; 16 };
16 17
17 TEST_F(ModelSafeWorkerTest, ModelSafeRoutingInfoToValue) { 18 TEST_F(ModelSafeWorkerTest, ModelSafeRoutingInfoToValue) {
18 ModelSafeRoutingInfo routing_info; 19 ModelSafeRoutingInfo routing_info;
19 routing_info[BOOKMARKS] = GROUP_PASSIVE; 20 routing_info[BOOKMARKS] = GROUP_PASSIVE;
20 routing_info[NIGORI] = GROUP_UI; 21 routing_info[NIGORI] = GROUP_UI;
21 routing_info[PREFERENCES] = GROUP_DB; 22 routing_info[PREFERENCES] = GROUP_DB;
22 routing_info[APPS] = GROUP_NON_BLOCKING; 23 routing_info[APPS] = GROUP_NON_BLOCKING;
23 base::DictionaryValue expected_value; 24 base::DictionaryValue expected_value;
24 expected_value.SetString("Apps", "GROUP_NON_BLOCKING"); 25 expected_value.SetString("Apps", "GROUP_NON_BLOCKING");
25 expected_value.SetString("Bookmarks", "GROUP_PASSIVE"); 26 expected_value.SetString("Bookmarks", "GROUP_PASSIVE");
26 expected_value.SetString("Encryption keys", "GROUP_UI"); 27 expected_value.SetString("Encryption keys", "GROUP_UI");
27 expected_value.SetString("Preferences", "GROUP_DB"); 28 expected_value.SetString("Preferences", "GROUP_DB");
28 scoped_ptr<base::DictionaryValue> value( 29 std::unique_ptr<base::DictionaryValue> value(
29 ModelSafeRoutingInfoToValue(routing_info)); 30 ModelSafeRoutingInfoToValue(routing_info));
30 EXPECT_TRUE(value->Equals(&expected_value)); 31 EXPECT_TRUE(value->Equals(&expected_value));
31 } 32 }
32 33
33 TEST_F(ModelSafeWorkerTest, ModelSafeRoutingInfoToString) { 34 TEST_F(ModelSafeWorkerTest, ModelSafeRoutingInfoToString) {
34 ModelSafeRoutingInfo routing_info; 35 ModelSafeRoutingInfo routing_info;
35 routing_info[APPS] = GROUP_NON_BLOCKING; 36 routing_info[APPS] = GROUP_NON_BLOCKING;
36 routing_info[BOOKMARKS] = GROUP_PASSIVE; 37 routing_info[BOOKMARKS] = GROUP_PASSIVE;
37 routing_info[NIGORI] = GROUP_UI; 38 routing_info[NIGORI] = GROUP_UI;
38 routing_info[PREFERENCES] = GROUP_DB; 39 routing_info[PREFERENCES] = GROUP_DB;
39 EXPECT_EQ( 40 EXPECT_EQ(
40 "{\"Apps\":\"GROUP_NON_BLOCKING\",\"Bookmarks\":\"GROUP_PASSIVE\"," 41 "{\"Apps\":\"GROUP_NON_BLOCKING\",\"Bookmarks\":\"GROUP_PASSIVE\","
41 "\"Encryption keys\":\"GROUP_UI\",\"Preferences\":\"GROUP_DB\"}", 42 "\"Encryption keys\":\"GROUP_UI\",\"Preferences\":\"GROUP_DB\"}",
42 ModelSafeRoutingInfoToString(routing_info)); 43 ModelSafeRoutingInfoToString(routing_info));
43 } 44 }
44 45
45 TEST_F(ModelSafeWorkerTest, GetRoutingInfoTypes) { 46 TEST_F(ModelSafeWorkerTest, GetRoutingInfoTypes) {
46 ModelSafeRoutingInfo routing_info; 47 ModelSafeRoutingInfo routing_info;
47 routing_info[BOOKMARKS] = GROUP_PASSIVE; 48 routing_info[BOOKMARKS] = GROUP_PASSIVE;
48 routing_info[NIGORI] = GROUP_UI; 49 routing_info[NIGORI] = GROUP_UI;
49 routing_info[PREFERENCES] = GROUP_DB; 50 routing_info[PREFERENCES] = GROUP_DB;
50 const ModelTypeSet expected_types(BOOKMARKS, NIGORI, PREFERENCES); 51 const ModelTypeSet expected_types(BOOKMARKS, NIGORI, PREFERENCES);
51 EXPECT_TRUE(GetRoutingInfoTypes(routing_info).Equals(expected_types)); 52 EXPECT_TRUE(GetRoutingInfoTypes(routing_info).Equals(expected_types));
52 } 53 }
53 54
54 } // namespace 55 } // namespace
55 } // namespace syncer 56 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698