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

Side by Side Diff: chrome/browser/prefs/pref_hash_calculator_unittest.cc

Issue 397793002: Eliminate CreateBooleanValue from test files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix bad merge Created 6 years, 5 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 | Annotate | Revision Log
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 "chrome/browser/prefs/pref_hash_calculator.h" 5 #include "chrome/browser/prefs/pref_hash_calculator.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 75
76 // Tests the output against a known value to catch unexpected algorithm changes. 76 // Tests the output against a known value to catch unexpected algorithm changes.
77 // The test hashes below must NEVER be updated, the serialization algorithm used 77 // The test hashes below must NEVER be updated, the serialization algorithm used
78 // must always be able to generate data that will produce these exact hashes. 78 // must always be able to generate data that will produce these exact hashes.
79 TEST(PrefHashCalculatorTest, CatchHashChanges) { 79 TEST(PrefHashCalculatorTest, CatchHashChanges) {
80 static const char kSeed[] = "0123456789ABCDEF0123456789ABCDEF"; 80 static const char kSeed[] = "0123456789ABCDEF0123456789ABCDEF";
81 static const char kDeviceId[] = "test_device_id1"; 81 static const char kDeviceId[] = "test_device_id1";
82 82
83 scoped_ptr<base::Value> null_value(base::Value::CreateNullValue()); 83 scoped_ptr<base::Value> null_value(base::Value::CreateNullValue());
84 scoped_ptr<base::Value> bool_value(base::Value::CreateBooleanValue(false)); 84 scoped_ptr<base::Value> bool_value(new base::FundamentalValue(false));
85 scoped_ptr<base::Value> int_value( 85 scoped_ptr<base::Value> int_value(
86 base::Value::CreateIntegerValue(1234567890)); 86 base::Value::CreateIntegerValue(1234567890));
87 scoped_ptr<base::Value> double_value( 87 scoped_ptr<base::Value> double_value(
88 new base::FundamentalValue(123.0987654321)); 88 new base::FundamentalValue(123.0987654321));
89 scoped_ptr<base::Value> string_value(base::Value::CreateStringValue( 89 scoped_ptr<base::Value> string_value(base::Value::CreateStringValue(
90 "testing with special chars:\n<>{}:^^@#$\\/")); 90 "testing with special chars:\n<>{}:^^@#$\\/"));
91 91
92 // For legacy reasons, we have to support pruning of empty lists/dictionaries 92 // For legacy reasons, we have to support pruning of empty lists/dictionaries
93 // and nested empty ists/dicts in the hash generation algorithm. 93 // and nested empty ists/dicts in the hash generation algorithm.
94 scoped_ptr<base::DictionaryValue> nested_empty_dict( 94 scoped_ptr<base::DictionaryValue> nested_empty_dict(
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // kSeed. 263 // kSeed.
264 static const char kTestedHash[] = 264 static const char kTestedHash[] =
265 "842C71283B9C3D86AA934CD639FDB0428BF0E2B6EC8537A21575CC4C4FA0A615"; 265 "842C71283B9C3D86AA934CD639FDB0428BF0E2B6EC8537A21575CC4C4FA0A615";
266 266
267 const base::StringValue string_value(kPrefValue); 267 const base::StringValue string_value(kPrefValue);
268 EXPECT_EQ(PrefHashCalculator::VALID, 268 EXPECT_EQ(PrefHashCalculator::VALID,
269 PrefHashCalculator(kSeed, kEmptyDeviceId, 269 PrefHashCalculator(kSeed, kEmptyDeviceId,
270 base::Bind(&MockGetLegacyDeviceId)).Validate( 270 base::Bind(&MockGetLegacyDeviceId)).Validate(
271 kPrefPath, &string_value, kTestedHash)); 271 kPrefPath, &string_value, kTestedHash));
272 } 272 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/chrome_pref_service_unittest.cc ('k') | chrome/browser/prefs/pref_hash_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698