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 "chrome/browser/extensions/extension_function_test_utils.h" | 5 #include "chrome/browser/extensions/extension_function_test_utils.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 EXPECT_EQ(base::Value::TYPE_DICTIONARY, val->GetType()); | 96 EXPECT_EQ(base::Value::TYPE_DICTIONARY, val->GetType()); |
97 return static_cast<base::DictionaryValue*>(val); | 97 return static_cast<base::DictionaryValue*>(val); |
98 } | 98 } |
99 | 99 |
100 base::ListValue* ToList(base::Value* val) { | 100 base::ListValue* ToList(base::Value* val) { |
101 EXPECT_TRUE(val); | 101 EXPECT_TRUE(val); |
102 EXPECT_EQ(base::Value::TYPE_LIST, val->GetType()); | 102 EXPECT_EQ(base::Value::TYPE_LIST, val->GetType()); |
103 return static_cast<base::ListValue*>(val); | 103 return static_cast<base::ListValue*>(val); |
104 } | 104 } |
105 | 105 |
106 scoped_refptr<Extension> CreateEmptyExtension() { | |
107 return CreateEmptyExtensionWithLocation(Manifest::INTERNAL); | |
108 } | |
109 | |
110 scoped_refptr<Extension> CreateEmptyExtensionWithLocation( | 106 scoped_refptr<Extension> CreateEmptyExtensionWithLocation( |
111 Manifest::Location location) { | 107 Manifest::Location location) { |
112 scoped_ptr<base::DictionaryValue> test_extension_value( | 108 scoped_ptr<base::DictionaryValue> test_extension_value( |
113 ParseDictionary("{\"name\": \"Test\", \"version\": \"1.0\"}")); | 109 ParseDictionary("{\"name\": \"Test\", \"version\": \"1.0\"}")); |
114 return CreateExtension(location, test_extension_value.get(), std::string()); | 110 return CreateExtension(location, test_extension_value.get(), std::string()); |
115 } | 111 } |
116 | 112 |
117 scoped_refptr<Extension> CreateEmptyExtension( | |
118 const std::string& id_input) { | |
119 scoped_ptr<base::DictionaryValue> test_extension_value( | |
120 ParseDictionary("{\"name\": \"Test\", \"version\": \"1.0\"}")); | |
121 return CreateExtension(Manifest::INTERNAL, test_extension_value.get(), | |
122 id_input); | |
123 } | |
124 | |
125 scoped_refptr<Extension> CreateExtension( | 113 scoped_refptr<Extension> CreateExtension( |
126 base::DictionaryValue* test_extension_value) { | 114 base::DictionaryValue* test_extension_value) { |
127 return CreateExtension(Manifest::INTERNAL, test_extension_value, | 115 return CreateExtension(Manifest::INTERNAL, test_extension_value, |
128 std::string()); | 116 std::string()); |
129 } | 117 } |
130 | 118 |
131 scoped_refptr<Extension> CreateExtension( | 119 scoped_refptr<Extension> CreateExtension( |
132 Manifest::Location location, | 120 Manifest::Location location, |
133 base::DictionaryValue* test_extension_value, | 121 base::DictionaryValue* test_extension_value, |
134 const std::string& id_input) { | 122 const std::string& id_input) { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 // only one place. See crbug.com/394840. | 248 // only one place. See crbug.com/394840. |
261 return extensions::api_test_utils::RunFunction( | 249 return extensions::api_test_utils::RunFunction( |
262 function, | 250 function, |
263 args.Pass(), | 251 args.Pass(), |
264 browser->profile(), | 252 browser->profile(), |
265 dispatcher.Pass(), | 253 dispatcher.Pass(), |
266 static_cast<extensions::api_test_utils::RunFunctionFlags>(flags)); | 254 static_cast<extensions::api_test_utils::RunFunctionFlags>(flags)); |
267 } | 255 } |
268 | 256 |
269 } // namespace extension_function_test_utils | 257 } // namespace extension_function_test_utils |
OLD | NEW |