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

Side by Side Diff: extensions/browser/value_store/value_store_unittest.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/value_store/value_store_unittest.h" 5 #include "extensions/browser/value_store/value_store_unittest.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/memory/linked_ptr.h" 8 #include "base/memory/linked_ptr.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 10
11 using content::BrowserThread; 11 using content::BrowserThread;
12 12
13 namespace { 13 namespace {
14 14
15 // To save typing ValueStore::DEFAULTS everywhere. 15 // To save typing ValueStore::DEFAULTS everywhere.
16 const ValueStore::WriteOptions DEFAULTS = ValueStore::DEFAULTS; 16 const ValueStore::WriteOptions DEFAULTS = ValueStore::DEFAULTS;
17 17
18 // Gets the pretty-printed JSON for a value. 18 // Gets the pretty-printed JSON for a value.
19 std::string GetJSON(const base::Value& value) { 19 std::string GetJSON(const base::Value& value) {
20 std::string json; 20 std::string json;
21 base::JSONWriter::WriteWithOptions(&value, 21 base::JSONWriter::WriteWithOptions(
22 base::JSONWriter::OPTIONS_PRETTY_PRINT, 22 value, base::JSONWriter::OPTIONS_PRETTY_PRINT, &json);
23 &json);
24 return json; 23 return json;
25 } 24 }
26 25
27 } // namespace 26 } // namespace
28 27
29 // Compares two possibly NULL values for equality, filling |error| with an 28 // Compares two possibly NULL values for equality, filling |error| with an
30 // appropriate error message if they're different. 29 // appropriate error message if they're different.
31 bool ValuesEqual(const base::Value* expected, 30 bool ValuesEqual(const base::Value* expected,
32 const base::Value* actual, 31 const base::Value* actual,
33 std::string* error) { 32 std::string* error) {
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 } 471 }
473 { 472 {
474 ValueStoreChangeList changes; 473 ValueStoreChangeList changes;
475 changes.push_back(ValueStoreChange(key3_, val3_->DeepCopy(), NULL)); 474 changes.push_back(ValueStoreChange(key3_, val3_->DeepCopy(), NULL));
476 changes.push_back( 475 changes.push_back(
477 ValueStoreChange("qwerty", val3_->DeepCopy(), NULL)); 476 ValueStoreChange("qwerty", val3_->DeepCopy(), NULL));
478 EXPECT_PRED_FORMAT2(ChangesEq, changes, storage_->Clear()); 477 EXPECT_PRED_FORMAT2(ChangesEq, changes, storage_->Clear());
479 EXPECT_PRED_FORMAT2(ChangesEq, ValueStoreChangeList(), storage_->Clear()); 478 EXPECT_PRED_FORMAT2(ChangesEq, ValueStoreChangeList(), storage_->Clear());
480 } 479 }
481 } 480 }
OLDNEW
« no previous file with comments | « extensions/browser/value_store/value_store_change.cc ('k') | extensions/common/permissions/manifest_permission.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698