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

Side by Side Diff: chrome/browser/extensions/api/declarative_webrequest/webrequest_action_unittest.cc

Issue 2740143002: Change base::Value::ListStorage to std::vector<base::Value> (Closed)
Patch Set: Comment Updates Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/api/declarative_webrequest/webrequest_action.h" 5 #include "extensions/browser/api/declarative_webrequest/webrequest_action.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 std::unique_ptr<WebRequestActionSet> CreateSetOfActions(const char* json) { 47 std::unique_ptr<WebRequestActionSet> CreateSetOfActions(const char* json) {
48 std::unique_ptr<base::Value> parsed_value(base::test::ParseJson(json)); 48 std::unique_ptr<base::Value> parsed_value(base::test::ParseJson(json));
49 const base::ListValue* parsed_list; 49 const base::ListValue* parsed_list;
50 CHECK(parsed_value->GetAsList(&parsed_list)); 50 CHECK(parsed_value->GetAsList(&parsed_list));
51 51
52 WebRequestActionSet::Values actions; 52 WebRequestActionSet::Values actions;
53 for (base::ListValue::const_iterator it = parsed_list->begin(); 53 for (base::ListValue::const_iterator it = parsed_list->begin();
54 it != parsed_list->end(); 54 it != parsed_list->end();
55 ++it) { 55 ++it) {
56 const base::DictionaryValue* dict; 56 const base::DictionaryValue* dict;
57 CHECK((*it)->GetAsDictionary(&dict)); 57 CHECK(it->GetAsDictionary(&dict));
58 actions.push_back(dict->CreateDeepCopy()); 58 actions.push_back(dict->CreateDeepCopy());
59 } 59 }
60 60
61 std::string error; 61 std::string error;
62 bool bad_message = false; 62 bool bad_message = false;
63 63
64 std::unique_ptr<WebRequestActionSet> action_set( 64 std::unique_ptr<WebRequestActionSet> action_set(
65 WebRequestActionSet::Create(NULL, NULL, actions, &error, &bad_message)); 65 WebRequestActionSet::Create(NULL, NULL, actions, &error, &bad_message));
66 EXPECT_EQ("", error); 66 EXPECT_EQ("", error);
67 EXPECT_FALSE(bad_message); 67 EXPECT_FALSE(bad_message);
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 for (WebRequestActionSet::Actions::const_iterator it = 588 for (WebRequestActionSet::Actions::const_iterator it =
589 action_set->actions().begin(); 589 action_set->actions().begin();
590 it != action_set->actions().end(); 590 it != action_set->actions().end();
591 ++it) { 591 ++it) {
592 EXPECT_EQ(kExpectedNames[index], (*it)->GetName()); 592 EXPECT_EQ(kExpectedNames[index], (*it)->GetName());
593 ++index; 593 ++index;
594 } 594 }
595 } 595 }
596 596
597 } // namespace extensions 597 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698