Chromium Code Reviews| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 base::FilePath test_file; | 97 base::FilePath test_file; |
| 98 if (!PathService::Get(DIR_TEST_DATA, &test_file)) { | 98 if (!PathService::Get(DIR_TEST_DATA, &test_file)) { |
| 99 EXPECT_FALSE(true); | 99 EXPECT_FALSE(true); |
| 100 return NULL; | 100 return NULL; |
| 101 } | 101 } |
| 102 test_file = test_file.AppendASCII(name); | 102 test_file = test_file.AppendASCII(name); |
| 103 int error_code = 0; | 103 int error_code = 0; |
| 104 std::string error; | 104 std::string error; |
| 105 JSONFileValueDeserializer deserializer( | 105 JSONFileValueDeserializer deserializer( |
| 106 test_file.AppendASCII("manifest.json")); | 106 test_file.AppendASCII("manifest.json")); |
| 107 scoped_ptr<base::DictionaryValue> valid_value( | 107 scoped_ptr<base::DictionaryValue> valid_value = |
| 108 static_cast<base::DictionaryValue*>( | 108 base::DictionaryValue::From(deserializer.Deserialize(NULL, &error)); |
|
Lei Zhang
2015/10/14 16:55:35
This used to pass in |error_code|
| |
| 109 deserializer.Deserialize(&error_code, &error))); | |
| 110 EXPECT_EQ(0, error_code) << error; | 109 EXPECT_EQ(0, error_code) << error; |
| 111 if (error_code != 0) | 110 if (error_code != 0) |
| 112 return NULL; | 111 return NULL; |
| 113 | 112 |
| 114 EXPECT_TRUE(valid_value.get()); | 113 EXPECT_TRUE(valid_value.get()); |
| 115 if (!valid_value) | 114 if (!valid_value) |
| 116 return NULL; | 115 return NULL; |
| 117 | 116 |
| 118 return Extension::Create(test_file, location, *valid_value, | 117 return Extension::Create(test_file, location, *valid_value, |
| 119 Extension::NO_FLAGS, &error); | 118 Extension::NO_FLAGS, &error); |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 544 // because image storage is shared, so when we created one from the first | 543 // because image storage is shared, so when we created one from the first |
| 545 // image, all other images should also have that representation... | 544 // image, all other images should also have that representation... |
| 546 gfx::Image image2 = icon_image->image(); | 545 gfx::Image image2 = icon_image->image(); |
| 547 EXPECT_EQ(image_as_png.get(), image2.As1xPNGBytes().get()); | 546 EXPECT_EQ(image_as_png.get(), image2.As1xPNGBytes().get()); |
| 548 | 547 |
| 549 // ...even images that were copied before the representation was constructed. | 548 // ...even images that were copied before the representation was constructed. |
| 550 EXPECT_EQ(image_as_png.get(), prior_image.As1xPNGBytes().get()); | 549 EXPECT_EQ(image_as_png.get(), prior_image.As1xPNGBytes().get()); |
| 551 } | 550 } |
| 552 | 551 |
| 553 } // namespace extensions | 552 } // namespace extensions |
| OLD | NEW |