diff options
author | pneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-18 14:43:27 +0000 |
---|---|---|
committer | pneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-18 14:43:27 +0000 |
commit | a899c0b0e1020347c5fc4bfc9c6d83cf13e8bd4a (patch) | |
tree | adf4d31e271ad9f54b6faf11be37acab769101c2 /chrome/test/ui/javascript_test_util.cc | |
parent | c622538f6219a0d9d10878a25e447081b3b3c72c (diff) | |
download | chromium_src-a899c0b0e1020347c5fc4bfc9c6d83cf13e8bd4a.zip chromium_src-a899c0b0e1020347c5fc4bfc9c6d83cf13e8bd4a.tar.gz chromium_src-a899c0b0e1020347c5fc4bfc9c6d83cf13e8bd4a.tar.bz2 |
Replaced DictionaryValue::key_iterator by DictionaryValue::Iterator outside of chrome/browser.
Marked Iterator::HasNext() as deprecated and added a method Iterator::CanAdvance() as replacement.
As DictionaryValue::Iterator is actually a const iterator, I had to add several missing const annotations, mostly, in json_schema_validator.* and command.*
BUG=162611
TEST=No new tests. Only semantically equivalent refactorings.
Review URL: https://chromiumcodereview.appspot.com/11418150
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177673 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/ui/javascript_test_util.cc')
-rw-r--r-- | chrome/test/ui/javascript_test_util.cc | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/chrome/test/ui/javascript_test_util.cc b/chrome/test/ui/javascript_test_util.cc index 5f97123..e9bd237 100644 --- a/chrome/test/ui/javascript_test_util.cc +++ b/chrome/test/ui/javascript_test_util.cc @@ -30,37 +30,17 @@ bool JsonDictionaryToMap(const std::string& json, DictionaryValue* dict = static_cast<DictionaryValue*>(root.get()); - for (DictionaryValue::key_iterator it = dict->begin_keys(); - it != dict->end_keys(); ++it) { - Value* value = NULL; - bool succeeded = dict->GetWithoutPathExpansion(*it, &value); - - EXPECT_TRUE(succeeded); - if (!succeeded) - continue; - - const std::string& key(*it); + for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { + double double_result; std::string result; - - switch (value->GetType()) { - case Value::TYPE_STRING: - succeeded = value->GetAsString(&result); - break; - case Value::TYPE_DOUBLE: { - double double_result; - succeeded = value->GetAsDouble(&double_result); - if (succeeded) - result = base::DoubleToString(double_result); - break; - } - default: - NOTREACHED() << "Value type not supported!"; - return false; + if (it.value().GetAsString(&result)) { + } else if (it.value().GetAsDouble(&double_result)) { + result = base::DoubleToString(double_result); + } else { + NOTREACHED() << "Value type not supported!"; + return false; } - - EXPECT_TRUE(succeeded); - if (succeeded) - results->insert(std::make_pair(key, result)); + results->insert(std::make_pair(it.key(), result)); } return true; |