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

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

Issue 106433007: Update some uses of Value in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years 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 | Annotate | Revision Log
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 "chrome/browser/extensions/api/declarative_webrequest/webrequest_action .h" 5 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_action .h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/json/json_file_value_serializer.h" 8 #include "base/json/json_file_value_serializer.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 23 matching lines...) Expand all
34 using extension_test_util::LoadManifestUnchecked; 34 using extension_test_util::LoadManifestUnchecked;
35 using testing::HasSubstr; 35 using testing::HasSubstr;
36 36
37 namespace extensions { 37 namespace extensions {
38 38
39 namespace { 39 namespace {
40 40
41 const char kUnknownActionType[] = "unknownType"; 41 const char kUnknownActionType[] = "unknownType";
42 42
43 scoped_ptr<WebRequestActionSet> CreateSetOfActions(const char* json) { 43 scoped_ptr<WebRequestActionSet> CreateSetOfActions(const char* json) {
44 scoped_ptr<Value> parsed_value(base::test::ParseJson(json)); 44 scoped_ptr<base::Value> parsed_value(base::test::ParseJson(json));
45 const ListValue* parsed_list; 45 const base::ListValue* parsed_list;
46 CHECK(parsed_value->GetAsList(&parsed_list)); 46 CHECK(parsed_value->GetAsList(&parsed_list));
47 47
48 WebRequestActionSet::AnyVector actions; 48 WebRequestActionSet::AnyVector actions;
49 for (ListValue::const_iterator it = parsed_list->begin(); 49 for (base::ListValue::const_iterator it = parsed_list->begin();
50 it != parsed_list->end(); 50 it != parsed_list->end();
51 ++it) { 51 ++it) {
52 const DictionaryValue* dict; 52 const base::DictionaryValue* dict;
53 CHECK((*it)->GetAsDictionary(&dict)); 53 CHECK((*it)->GetAsDictionary(&dict));
54 actions.push_back(linked_ptr<base::Value>(dict->DeepCopy())); 54 actions.push_back(linked_ptr<base::Value>(dict->DeepCopy()));
55 } 55 }
56 56
57 std::string error; 57 std::string error;
58 bool bad_message = false; 58 bool bad_message = false;
59 59
60 scoped_ptr<WebRequestActionSet> action_set( 60 scoped_ptr<WebRequestActionSet> action_set(
61 WebRequestActionSet::Create(NULL, actions, &error, &bad_message)); 61 WebRequestActionSet::Create(NULL, actions, &error, &bad_message));
62 EXPECT_EQ("", error); 62 EXPECT_EQ("", error);
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 223
224 // Test empty input. 224 // Test empty input.
225 error.clear(); 225 error.clear();
226 result = WebRequestActionSet::Create(NULL, input, &error, &bad_message); 226 result = WebRequestActionSet::Create(NULL, input, &error, &bad_message);
227 EXPECT_TRUE(error.empty()) << error; 227 EXPECT_TRUE(error.empty()) << error;
228 EXPECT_FALSE(bad_message); 228 EXPECT_FALSE(bad_message);
229 ASSERT_TRUE(result.get()); 229 ASSERT_TRUE(result.get());
230 EXPECT_TRUE(result->actions().empty()); 230 EXPECT_TRUE(result->actions().empty());
231 EXPECT_EQ(std::numeric_limits<int>::min(), result->GetMinimumPriority()); 231 EXPECT_EQ(std::numeric_limits<int>::min(), result->GetMinimumPriority());
232 232
233 DictionaryValue correct_action; 233 base::DictionaryValue correct_action;
234 correct_action.SetString(keys::kInstanceTypeKey, keys::kIgnoreRulesType); 234 correct_action.SetString(keys::kInstanceTypeKey, keys::kIgnoreRulesType);
235 correct_action.SetInteger(keys::kLowerPriorityThanKey, 10); 235 correct_action.SetInteger(keys::kLowerPriorityThanKey, 10);
236 DictionaryValue incorrect_action; 236 base::DictionaryValue incorrect_action;
237 incorrect_action.SetString(keys::kInstanceTypeKey, kUnknownActionType); 237 incorrect_action.SetString(keys::kInstanceTypeKey, kUnknownActionType);
238 238
239 // Test success. 239 // Test success.
240 input.push_back(linked_ptr<base::Value>(correct_action.DeepCopy())); 240 input.push_back(linked_ptr<base::Value>(correct_action.DeepCopy()));
241 error.clear(); 241 error.clear();
242 result = WebRequestActionSet::Create(NULL, input, &error, &bad_message); 242 result = WebRequestActionSet::Create(NULL, input, &error, &bad_message);
243 EXPECT_TRUE(error.empty()) << error; 243 EXPECT_TRUE(error.empty()) << error;
244 EXPECT_FALSE(bad_message); 244 EXPECT_FALSE(bad_message);
245 ASSERT_TRUE(result.get()); 245 ASSERT_TRUE(result.get());
246 ASSERT_EQ(1u, result->actions().size()); 246 ASSERT_EQ(1u, result->actions().size());
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 for (WebRequestActionSet::Actions::const_iterator it = 572 for (WebRequestActionSet::Actions::const_iterator it =
573 action_set->actions().begin(); 573 action_set->actions().begin();
574 it != action_set->actions().end(); 574 it != action_set->actions().end();
575 ++it) { 575 ++it) {
576 EXPECT_EQ(kExpectedNames[index], (*it)->GetName()); 576 EXPECT_EQ(kExpectedNames[index], (*it)->GetName());
577 ++index; 577 ++index;
578 } 578 }
579 } 579 }
580 580
581 } // namespace extensions 581 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698