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

Side by Side Diff: components/user_prefs/tracked/pref_hash_calculator_unittest.cc

Issue 2476493003: Remove FundamentalValue
Patch Set: Fix Created 4 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/user_prefs/tracked/pref_hash_calculator.h" 5 #include "components/user_prefs/tracked/pref_hash_calculator.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 71
72 // Tests the output against a known value to catch unexpected algorithm changes. 72 // Tests the output against a known value to catch unexpected algorithm changes.
73 // The test hashes below must NEVER be updated, the serialization algorithm used 73 // The test hashes below must NEVER be updated, the serialization algorithm used
74 // must always be able to generate data that will produce these exact hashes. 74 // must always be able to generate data that will produce these exact hashes.
75 TEST(PrefHashCalculatorTest, CatchHashChanges) { 75 TEST(PrefHashCalculatorTest, CatchHashChanges) {
76 static const char kSeed[] = "0123456789ABCDEF0123456789ABCDEF"; 76 static const char kSeed[] = "0123456789ABCDEF0123456789ABCDEF";
77 static const char kDeviceId[] = "test_device_id1"; 77 static const char kDeviceId[] = "test_device_id1";
78 78
79 std::unique_ptr<base::Value> null_value = base::Value::CreateNullValue(); 79 std::unique_ptr<base::Value> null_value = base::Value::CreateNullValue();
80 std::unique_ptr<base::Value> bool_value(new base::FundamentalValue(false)); 80 std::unique_ptr<base::Value> bool_value(new base::Value(false));
81 std::unique_ptr<base::Value> int_value( 81 std::unique_ptr<base::Value> int_value(
82 new base::FundamentalValue(1234567890)); 82 new base::Value(1234567890));
83 std::unique_ptr<base::Value> double_value( 83 std::unique_ptr<base::Value> double_value(
84 new base::FundamentalValue(123.0987654321)); 84 new base::Value(123.0987654321));
85 std::unique_ptr<base::Value> string_value( 85 std::unique_ptr<base::Value> string_value(
86 new base::StringValue("testing with special chars:\n<>{}:^^@#$\\/")); 86 new base::StringValue("testing with special chars:\n<>{}:^^@#$\\/"));
87 87
88 // For legacy reasons, we have to support pruning of empty lists/dictionaries 88 // For legacy reasons, we have to support pruning of empty lists/dictionaries
89 // and nested empty ists/dicts in the hash generation algorithm. 89 // and nested empty ists/dicts in the hash generation algorithm.
90 std::unique_ptr<base::DictionaryValue> nested_empty_dict( 90 std::unique_ptr<base::DictionaryValue> nested_empty_dict(
91 new base::DictionaryValue); 91 new base::DictionaryValue);
92 nested_empty_dict->Set("a", new base::DictionaryValue); 92 nested_empty_dict->Set("a", new base::DictionaryValue);
93 nested_empty_dict->Set("b", new base::ListValue); 93 nested_empty_dict->Set("b", new base::ListValue);
94 std::unique_ptr<base::ListValue> nested_empty_list(new base::ListValue); 94 std::unique_ptr<base::ListValue> nested_empty_list(new base::ListValue);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 "845EF34663FF8D32BE6707F40258FBA531C2BFC532E3B014AFB3476115C2A9DE"; 196 "845EF34663FF8D32BE6707F40258FBA531C2BFC532E3B014AFB3476115C2A9DE";
197 197
198 base::ListValue startup_urls; 198 base::ListValue startup_urls;
199 startup_urls.Set(0, new base::StringValue("http://www.chromium.org/")); 199 startup_urls.Set(0, new base::StringValue("http://www.chromium.org/"));
200 200
201 EXPECT_EQ( 201 EXPECT_EQ(
202 PrefHashCalculator::VALID_SECURE_LEGACY, 202 PrefHashCalculator::VALID_SECURE_LEGACY,
203 PrefHashCalculator(std::string(kSeed, arraysize(kSeed)), kDeviceId) 203 PrefHashCalculator(std::string(kSeed, arraysize(kSeed)), kDeviceId)
204 .Validate("session.startup_urls", &startup_urls, kExpectedValue)); 204 .Validate("session.startup_urls", &startup_urls, kExpectedValue));
205 } 205 }
OLDNEW
« no previous file with comments | « components/user_manager/user_manager_base.cc ('k') | components/user_prefs/tracked/pref_hash_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698