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_action_icon_factory.h" | 5 #include "chrome/browser/extensions/extension_action_icon_factory.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/json/json_file_value_serializer.h" | 9 #include "base/json/json_file_value_serializer.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 Manifest::Location location) { | 100 Manifest::Location location) { |
101 // Create and load an extension. | 101 // Create and load an extension. |
102 base::FilePath test_file; | 102 base::FilePath test_file; |
103 if (!PathService::Get(chrome::DIR_TEST_DATA, &test_file)) { | 103 if (!PathService::Get(chrome::DIR_TEST_DATA, &test_file)) { |
104 EXPECT_FALSE(true); | 104 EXPECT_FALSE(true); |
105 return NULL; | 105 return NULL; |
106 } | 106 } |
107 test_file = test_file.AppendASCII("extensions/api_test").AppendASCII(name); | 107 test_file = test_file.AppendASCII("extensions/api_test").AppendASCII(name); |
108 int error_code = 0; | 108 int error_code = 0; |
109 std::string error; | 109 std::string error; |
110 JSONFileValueSerializer serializer(test_file.AppendASCII("manifest.json")); | 110 JSONFileValueDeserializer deserializer( |
| 111 test_file.AppendASCII("manifest.json")); |
111 scoped_ptr<base::DictionaryValue> valid_value( | 112 scoped_ptr<base::DictionaryValue> valid_value( |
112 static_cast<base::DictionaryValue*>(serializer.Deserialize(&error_code, | 113 static_cast<base::DictionaryValue*>( |
113 &error))); | 114 deserializer.Deserialize(&error_code, |
| 115 &error))); |
114 EXPECT_EQ(0, error_code) << error; | 116 EXPECT_EQ(0, error_code) << error; |
115 if (error_code != 0) | 117 if (error_code != 0) |
116 return NULL; | 118 return NULL; |
117 | 119 |
118 EXPECT_TRUE(valid_value.get()); | 120 EXPECT_TRUE(valid_value.get()); |
119 if (!valid_value) | 121 if (!valid_value) |
120 return NULL; | 122 return NULL; |
121 | 123 |
122 scoped_refptr<Extension> extension = | 124 scoped_refptr<Extension> extension = |
123 Extension::Create(test_file, location, *valid_value, | 125 Extension::Create(test_file, location, *valid_value, |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 icon = icon_factory.GetIcon(1); | 292 icon = icon_factory.GetIcon(1); |
291 | 293 |
292 EXPECT_TRUE(ImageRepsAreEqual( | 294 EXPECT_TRUE(ImageRepsAreEqual( |
293 default_icon.ToImageSkia()->GetRepresentation(1.0f), | 295 default_icon.ToImageSkia()->GetRepresentation(1.0f), |
294 icon.ToImageSkia()->GetRepresentation(1.0f))); | 296 icon.ToImageSkia()->GetRepresentation(1.0f))); |
295 | 297 |
296 } | 298 } |
297 | 299 |
298 } // namespace | 300 } // namespace |
299 } // namespace extensions | 301 } // namespace extensions |
OLD | NEW |