| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |