OLD | NEW |
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 std::unique_ptr<WebRequestActionSet> CreateSetOfActions(const char* json) { | 48 std::unique_ptr<WebRequestActionSet> CreateSetOfActions(const char* json) { |
49 std::unique_ptr<base::Value> parsed_value(base::test::ParseJson(json)); | 49 std::unique_ptr<base::Value> parsed_value(base::test::ParseJson(json)); |
50 const base::ListValue* parsed_list; | 50 const base::ListValue* parsed_list; |
51 CHECK(parsed_value->GetAsList(&parsed_list)); | 51 CHECK(parsed_value->GetAsList(&parsed_list)); |
52 | 52 |
53 WebRequestActionSet::Values actions; | 53 WebRequestActionSet::Values actions; |
54 for (base::ListValue::const_iterator it = parsed_list->begin(); | 54 for (base::ListValue::const_iterator it = parsed_list->begin(); |
55 it != parsed_list->end(); | 55 it != parsed_list->end(); |
56 ++it) { | 56 ++it) { |
57 const base::DictionaryValue* dict; | 57 const base::DictionaryValue* dict; |
58 CHECK(it->GetAsDictionary(&dict)); | 58 CHECK((*it)->GetAsDictionary(&dict)); |
59 actions.push_back(dict->CreateDeepCopy()); | 59 actions.push_back(dict->CreateDeepCopy()); |
60 } | 60 } |
61 | 61 |
62 std::string error; | 62 std::string error; |
63 bool bad_message = false; | 63 bool bad_message = false; |
64 | 64 |
65 std::unique_ptr<WebRequestActionSet> action_set( | 65 std::unique_ptr<WebRequestActionSet> action_set( |
66 WebRequestActionSet::Create(NULL, NULL, actions, &error, &bad_message)); | 66 WebRequestActionSet::Create(NULL, NULL, actions, &error, &bad_message)); |
67 EXPECT_EQ("", error); | 67 EXPECT_EQ("", error); |
68 EXPECT_FALSE(bad_message); | 68 EXPECT_FALSE(bad_message); |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 for (WebRequestActionSet::Actions::const_iterator it = | 590 for (WebRequestActionSet::Actions::const_iterator it = |
591 action_set->actions().begin(); | 591 action_set->actions().begin(); |
592 it != action_set->actions().end(); | 592 it != action_set->actions().end(); |
593 ++it) { | 593 ++it) { |
594 EXPECT_EQ(kExpectedNames[index], (*it)->GetName()); | 594 EXPECT_EQ(kExpectedNames[index], (*it)->GetName()); |
595 ++index; | 595 ++index; |
596 } | 596 } |
597 } | 597 } |
598 | 598 |
599 } // namespace extensions | 599 } // namespace extensions |
OLD | NEW |