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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 JSONFileValueDeserializer deserializer( | 110 JSONFileValueDeserializer deserializer( |
111 test_file.AppendASCII("manifest.json")); | 111 test_file.AppendASCII("manifest.json")); |
112 scoped_ptr<base::DictionaryValue> valid_value( | 112 scoped_ptr<base::DictionaryValue> valid_value = base::DictionaryValue::From( |
113 static_cast<base::DictionaryValue*>( | 113 deserializer.Deserialize(&error_code, &error)); |
114 deserializer.Deserialize(&error_code, | |
115 &error))); | |
116 EXPECT_EQ(0, error_code) << error; | 114 EXPECT_EQ(0, error_code) << error; |
117 if (error_code != 0) | 115 if (error_code != 0) |
118 return NULL; | 116 return NULL; |
119 | 117 |
120 EXPECT_TRUE(valid_value.get()); | 118 EXPECT_TRUE(valid_value.get()); |
121 if (!valid_value) | 119 if (!valid_value) |
122 return NULL; | 120 return NULL; |
123 | 121 |
124 scoped_refptr<Extension> extension = | 122 scoped_refptr<Extension> extension = |
125 Extension::Create(test_file, location, *valid_value, | 123 Extension::Create(test_file, location, *valid_value, |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 icon = icon_factory.GetIcon(1); | 290 icon = icon_factory.GetIcon(1); |
293 | 291 |
294 EXPECT_TRUE(ImageRepsAreEqual( | 292 EXPECT_TRUE(ImageRepsAreEqual( |
295 default_icon.ToImageSkia()->GetRepresentation(1.0f), | 293 default_icon.ToImageSkia()->GetRepresentation(1.0f), |
296 icon.ToImageSkia()->GetRepresentation(1.0f))); | 294 icon.ToImageSkia()->GetRepresentation(1.0f))); |
297 | 295 |
298 } | 296 } |
299 | 297 |
300 } // namespace | 298 } // namespace |
301 } // namespace extensions | 299 } // namespace extensions |
OLD | NEW |