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

Side by Side Diff: chrome/browser/extensions/settings/settings_sync_unittest.cc

Issue 9590002: JSONWriter cleanup: integrate pretty print into write options. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflict 7. Created 8 years, 9 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 (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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 16 matching lines...) Expand all
27 namespace util = settings_test_util; 27 namespace util = settings_test_util;
28 28
29 namespace { 29 namespace {
30 30
31 // To save typing SettingsStorage::DEFAULTS everywhere. 31 // To save typing SettingsStorage::DEFAULTS everywhere.
32 const SettingsStorage::WriteOptions DEFAULTS = SettingsStorage::DEFAULTS; 32 const SettingsStorage::WriteOptions DEFAULTS = SettingsStorage::DEFAULTS;
33 33
34 // Gets the pretty-printed JSON for a value. 34 // Gets the pretty-printed JSON for a value.
35 static std::string GetJson(const Value& value) { 35 static std::string GetJson(const Value& value) {
36 std::string json; 36 std::string json;
37 base::JSONWriter::Write(&value, true, &json); 37 base::JSONWriter::WriteWithOptions(&value,
38 base::JSONWriter::OPTIONS_PRETTY_PRINT,
39 &json);
38 return json; 40 return json;
39 } 41 }
40 42
41 // Returns whether two Values are equal. 43 // Returns whether two Values are equal.
42 testing::AssertionResult ValuesEq( 44 testing::AssertionResult ValuesEq(
43 const char* _1, const char* _2, 45 const char* _1, const char* _2,
44 const Value* expected, 46 const Value* expected,
45 const Value* actual) { 47 const Value* actual) {
46 if (expected == actual) { 48 if (expected == actual) {
47 return testing::AssertionSuccess(); 49 return testing::AssertionSuccess();
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 DictionaryValue expected; 1283 DictionaryValue expected;
1282 expected.Set("large_value", large_value.DeepCopy()); 1284 expected.Set("large_value", large_value.DeepCopy());
1283 EXPECT_PRED_FORMAT2(SettingsEq, expected, storage1->Get()); 1285 EXPECT_PRED_FORMAT2(SettingsEq, expected, storage1->Get());
1284 EXPECT_PRED_FORMAT2(SettingsEq, expected, storage2->Get()); 1286 EXPECT_PRED_FORMAT2(SettingsEq, expected, storage2->Get());
1285 } 1287 }
1286 1288
1287 GetSyncableService(model_type)->StopSyncing(model_type); 1289 GetSyncableService(model_type)->StopSyncing(model_type);
1288 } 1290 }
1289 1291
1290 } // namespace extensions 1292 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698