| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extensions/settings/settings_storage_unittest.h" | 5 #include "chrome/browser/extensions/settings/settings_storage_unittest.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 | 10 |
| 11 namespace extensions { | 11 namespace extensions { |
| 12 | 12 |
| 13 using content::BrowserThread; | 13 using content::BrowserThread; |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 // To save typing SettingsStorage::DEFAULTS everywhere. | 17 // To save typing SettingsStorage::DEFAULTS everywhere. |
| 18 const SettingsStorage::WriteOptions DEFAULTS = SettingsStorage::DEFAULTS; | 18 const SettingsStorage::WriteOptions DEFAULTS = SettingsStorage::DEFAULTS; |
| 19 | 19 |
| 20 // Gets the pretty-printed JSON for a value. | 20 // Gets the pretty-printed JSON for a value. |
| 21 std::string GetJSON(const Value& value) { | 21 std::string GetJSON(const Value& value) { |
| 22 std::string json; | 22 std::string json; |
| 23 base::JSONWriter::Write(&value, true, &json); | 23 base::JSONWriter::WriteWithOptions(&value, |
| 24 base::JSONWriter::OPTIONS_PRETTY_PRINT, |
| 25 &json); |
| 24 return json; | 26 return json; |
| 25 } | 27 } |
| 26 | 28 |
| 27 // Pretty-prints a set of strings. | 29 // Pretty-prints a set of strings. |
| 28 std::string ToString(const std::set<std::string>& strings) { | 30 std::string ToString(const std::set<std::string>& strings) { |
| 29 std::string string("{"); | 31 std::string string("{"); |
| 30 for (std::set<std::string>::const_iterator it = strings.begin(); | 32 for (std::set<std::string>::const_iterator it = strings.begin(); |
| 31 it != strings.end(); ++it) { | 33 it != strings.end(); ++it) { |
| 32 if (it != strings.begin()) { | 34 if (it != strings.begin()) { |
| 33 string.append(", "); | 35 string.append(", "); |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 SettingChangeList changes; | 488 SettingChangeList changes; |
| 487 changes.push_back(SettingChange(key3_, val3_->DeepCopy(), NULL)); | 489 changes.push_back(SettingChange(key3_, val3_->DeepCopy(), NULL)); |
| 488 changes.push_back( | 490 changes.push_back( |
| 489 SettingChange("qwerty", val3_->DeepCopy(), NULL)); | 491 SettingChange("qwerty", val3_->DeepCopy(), NULL)); |
| 490 EXPECT_PRED_FORMAT2(ChangesEq, changes, storage_->Clear()); | 492 EXPECT_PRED_FORMAT2(ChangesEq, changes, storage_->Clear()); |
| 491 EXPECT_PRED_FORMAT2(ChangesEq, SettingChangeList(), storage_->Clear()); | 493 EXPECT_PRED_FORMAT2(ChangesEq, SettingChangeList(), storage_->Clear()); |
| 492 } | 494 } |
| 493 } | 495 } |
| 494 | 496 |
| 495 } // namespace extensions | 497 } // namespace extensions |
| OLD | NEW |