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

Unified Diff: chrome/test/webdriver/webdriver_util.cc

Issue 12601006: Removing base::DictionaryValue::key_iterator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initial patch. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/webdriver/webdriver_capabilities_parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/webdriver/webdriver_util.cc
diff --git a/chrome/test/webdriver/webdriver_util.cc b/chrome/test/webdriver/webdriver_util.cc
index b17abb2cb31f6d799375ddf375f2f2c14fe13772..568e842da36dfa269c9ff0d4fa4b3b5ebb63a95c 100644
--- a/chrome/test/webdriver/webdriver_util.cc
+++ b/chrome/test/webdriver/webdriver_util.cc
@@ -409,19 +409,17 @@ void TruncateString(std::string* data) {
// Truncates all strings contained in the given value.
void TruncateContainedStrings(Value* value) {
- ListValue* list;
- if (value->IsType(Value::TYPE_DICTIONARY)) {
- DictionaryValue* dict = static_cast<DictionaryValue*>(value);
- DictionaryValue::key_iterator key = dict->begin_keys();
- for (; key != dict->end_keys(); ++key) {
- Value* child;
- if (!dict->GetWithoutPathExpansion(*key, &child))
- continue;
+ ListValue* list = NULL;
+ DictionaryValue* dict = NULL;
+ if (value->GetAsDictionary(&dict)) {
+ for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) {
std::string data;
- if (child->GetAsString(&data)) {
+ if (it.value().GetAsString(&data)) {
TruncateString(&data);
- dict->SetWithoutPathExpansion(*key, new base::StringValue(data));
+ dict->SetWithoutPathExpansion(it.key(), new base::StringValue(data));
} else {
+ Value* child = NULL;
+ dict->GetWithoutPathExpansion(it.key(), &child);
TruncateContainedStrings(child);
}
}
« no previous file with comments | « chrome/test/webdriver/webdriver_capabilities_parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698