| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 ADD_FAILURE() << key << " does not exist or is not a string."; | 87 ADD_FAILURE() << key << " does not exist or is not a string."; |
| 88 return result; | 88 return result; |
| 89 } | 89 } |
| 90 | 90 |
| 91 base::DictionaryValue* ToDictionary(base::Value* val) { | 91 base::DictionaryValue* ToDictionary(base::Value* val) { |
| 92 EXPECT_TRUE(val); | 92 EXPECT_TRUE(val); |
| 93 EXPECT_EQ(base::Value::TYPE_DICTIONARY, val->GetType()); | 93 EXPECT_EQ(base::Value::TYPE_DICTIONARY, val->GetType()); |
| 94 return static_cast<base::DictionaryValue*>(val); | 94 return static_cast<base::DictionaryValue*>(val); |
| 95 } | 95 } |
| 96 | 96 |
| 97 base::ListValue* ToList(base::Value* val) { |
| 98 EXPECT_TRUE(val); |
| 99 EXPECT_EQ(base::Value::TYPE_LIST, val->GetType()); |
| 100 return static_cast<base::ListValue*>(val); |
| 101 } |
| 102 |
| 97 scoped_refptr<Extension> CreateEmptyExtension() { | 103 scoped_refptr<Extension> CreateEmptyExtension() { |
| 98 std::string error; | 104 std::string error; |
| 99 const FilePath test_extension_path; | 105 const FilePath test_extension_path; |
| 100 scoped_ptr<base::DictionaryValue> test_extension_value( | 106 scoped_ptr<base::DictionaryValue> test_extension_value( |
| 101 ParseDictionary("{\"name\": \"Test\", \"version\": \"1.0\"}")); | 107 ParseDictionary("{\"name\": \"Test\", \"version\": \"1.0\"}")); |
| 102 scoped_refptr<Extension> extension(Extension::Create( | 108 scoped_refptr<Extension> extension(Extension::Create( |
| 103 test_extension_path, | 109 test_extension_path, |
| 104 Extension::INTERNAL, | 110 Extension::INTERNAL, |
| 105 *test_extension_value.get(), | 111 *test_extension_value.get(), |
| 106 Extension::NO_FLAGS, | 112 Extension::NO_FLAGS, |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 if (!response_delegate.HasResponse()) { | 210 if (!response_delegate.HasResponse()) { |
| 205 response_delegate.set_should_post_quit(true); | 211 response_delegate.set_should_post_quit(true); |
| 206 ui_test_utils::RunMessageLoop(); | 212 ui_test_utils::RunMessageLoop(); |
| 207 } | 213 } |
| 208 | 214 |
| 209 EXPECT_TRUE(response_delegate.HasResponse()); | 215 EXPECT_TRUE(response_delegate.HasResponse()); |
| 210 return response_delegate.GetResponse(); | 216 return response_delegate.GetResponse(); |
| 211 } | 217 } |
| 212 | 218 |
| 213 } // namespace extension_function_test_utils | 219 } // namespace extension_function_test_utils |
| OLD | NEW |