OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extension_icon_image.h" | 5 #include "extensions/browser/extension_icon_image.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 Manifest::Location location) { | 143 Manifest::Location location) { |
144 // Create and load an extension. | 144 // Create and load an extension. |
145 base::FilePath test_file; | 145 base::FilePath test_file; |
146 if (!PathService::Get(DIR_TEST_DATA, &test_file)) { | 146 if (!PathService::Get(DIR_TEST_DATA, &test_file)) { |
147 EXPECT_FALSE(true); | 147 EXPECT_FALSE(true); |
148 return NULL; | 148 return NULL; |
149 } | 149 } |
150 test_file = test_file.AppendASCII(name); | 150 test_file = test_file.AppendASCII(name); |
151 int error_code = 0; | 151 int error_code = 0; |
152 std::string error; | 152 std::string error; |
153 JSONFileValueSerializer serializer(test_file.AppendASCII("manifest.json")); | 153 JSONFileValueDeserializer deserializer( |
| 154 test_file.AppendASCII("manifest.json")); |
154 scoped_ptr<base::DictionaryValue> valid_value( | 155 scoped_ptr<base::DictionaryValue> valid_value( |
155 static_cast<base::DictionaryValue*>(serializer.Deserialize(&error_code, | 156 static_cast<base::DictionaryValue*>( |
156 &error))); | 157 deserializer.Deserialize(&error_code, &error))); |
157 EXPECT_EQ(0, error_code) << error; | 158 EXPECT_EQ(0, error_code) << error; |
158 if (error_code != 0) | 159 if (error_code != 0) |
159 return NULL; | 160 return NULL; |
160 | 161 |
161 EXPECT_TRUE(valid_value.get()); | 162 EXPECT_TRUE(valid_value.get()); |
162 if (!valid_value) | 163 if (!valid_value) |
163 return NULL; | 164 return NULL; |
164 | 165 |
165 return Extension::Create(test_file, location, *valid_value, | 166 return Extension::Create(test_file, location, *valid_value, |
166 Extension::NO_FLAGS, &error); | 167 Extension::NO_FLAGS, &error); |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 // because image storage is shared, so when we created one from the first | 597 // because image storage is shared, so when we created one from the first |
597 // image, all other images should also have that representation... | 598 // image, all other images should also have that representation... |
598 gfx::Image image2 = icon_image->image(); | 599 gfx::Image image2 = icon_image->image(); |
599 EXPECT_EQ(image_as_png.get(), image2.As1xPNGBytes().get()); | 600 EXPECT_EQ(image_as_png.get(), image2.As1xPNGBytes().get()); |
600 | 601 |
601 // ...even images that were copied before the representation was constructed. | 602 // ...even images that were copied before the representation was constructed. |
602 EXPECT_EQ(image_as_png.get(), prior_image.As1xPNGBytes().get()); | 603 EXPECT_EQ(image_as_png.get(), prior_image.As1xPNGBytes().get()); |
603 } | 604 } |
604 | 605 |
605 } // namespace extensions | 606 } // namespace extensions |
OLD | NEW |