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/image_loader.h" | 5 #include "extensions/browser/image_loader.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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 base::FilePath extension_dir; | 76 base::FilePath extension_dir; |
77 if (!PathService::Get(DIR_TEST_DATA, &extension_dir)) { | 77 if (!PathService::Get(DIR_TEST_DATA, &extension_dir)) { |
78 EXPECT_FALSE(true); | 78 EXPECT_FALSE(true); |
79 return NULL; | 79 return NULL; |
80 } | 80 } |
81 extension_dir = extension_dir.AppendASCII(dir_name); | 81 extension_dir = extension_dir.AppendASCII(dir_name); |
82 int error_code = 0; | 82 int error_code = 0; |
83 std::string error; | 83 std::string error; |
84 JSONFileValueDeserializer deserializer( | 84 JSONFileValueDeserializer deserializer( |
85 extension_dir.AppendASCII("manifest.json")); | 85 extension_dir.AppendASCII("manifest.json")); |
86 scoped_ptr<base::DictionaryValue> valid_value( | 86 scoped_ptr<base::DictionaryValue> valid_value = base::DictionaryValue::From( |
87 static_cast<base::DictionaryValue*>( | 87 deserializer.Deserialize(&error_code, &error)); |
88 deserializer.Deserialize(&error_code, &error))); | |
89 EXPECT_EQ(0, error_code) << error; | 88 EXPECT_EQ(0, error_code) << error; |
90 if (error_code != 0) | 89 if (error_code != 0) |
91 return NULL; | 90 return NULL; |
92 | 91 |
93 EXPECT_TRUE(valid_value.get()); | 92 EXPECT_TRUE(valid_value.get()); |
94 if (!valid_value) | 93 if (!valid_value) |
95 return NULL; | 94 return NULL; |
96 | 95 |
97 return Extension::Create( | 96 return Extension::Create( |
98 extension_dir, location, *valid_value, Extension::NO_FLAGS, &error); | 97 extension_dir, location, *valid_value, Extension::NO_FLAGS, &error); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 301 |
303 const gfx::ImageSkiaRep* img_rep1 = &image_reps[0]; | 302 const gfx::ImageSkiaRep* img_rep1 = &image_reps[0]; |
304 const gfx::ImageSkiaRep* img_rep2 = &image_reps[1]; | 303 const gfx::ImageSkiaRep* img_rep2 = &image_reps[1]; |
305 EXPECT_EQ(extension_misc::EXTENSION_ICON_BITTY, img_rep1->pixel_width()); | 304 EXPECT_EQ(extension_misc::EXTENSION_ICON_BITTY, img_rep1->pixel_width()); |
306 EXPECT_EQ(1.0f, img_rep1->scale()); | 305 EXPECT_EQ(1.0f, img_rep1->scale()); |
307 EXPECT_EQ(extension_misc::EXTENSION_ICON_SMALLISH, img_rep2->pixel_width()); | 306 EXPECT_EQ(extension_misc::EXTENSION_ICON_SMALLISH, img_rep2->pixel_width()); |
308 EXPECT_EQ(2.0f, img_rep2->scale()); | 307 EXPECT_EQ(2.0f, img_rep2->scale()); |
309 } | 308 } |
310 | 309 |
311 } // namespace extensions | 310 } // namespace extensions |
OLD | NEW |