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 "base/json/json_file_value_serializer.h" | 5 #include "base/json/json_file_value_serializer.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); | 110 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); |
111 base::FilePath manifest_path = test_dir.AppendASCII( | 111 base::FilePath manifest_path = test_dir.AppendASCII( |
112 "extensions/image_loading_tracker/app.json"); | 112 "extensions/image_loading_tracker/app.json"); |
113 | 113 |
114 JSONFileValueDeserializer deserializer(manifest_path); | 114 JSONFileValueDeserializer deserializer(manifest_path); |
115 std::unique_ptr<base::DictionaryValue> manifest = | 115 std::unique_ptr<base::DictionaryValue> manifest = |
116 base::DictionaryValue::From(deserializer.Deserialize(NULL, NULL)); | 116 base::DictionaryValue::From(deserializer.Deserialize(NULL, NULL)); |
117 ASSERT_TRUE(manifest.get() != NULL); | 117 ASSERT_TRUE(manifest.get() != NULL); |
118 | 118 |
119 std::string error; | 119 std::string error; |
120 scoped_refptr<Extension> extension(Extension::Create( | 120 scoped_refptr<Extension> extension( |
121 manifest_path.DirName(), Manifest::INVALID_LOCATION, *manifest.get(), | 121 Extension::Create(manifest_path.DirName(), Manifest::INVALID_LOCATION, |
122 Extension::NO_FLAGS, &error)); | 122 *manifest, Extension::NO_FLAGS, &error)); |
123 ASSERT_TRUE(extension.get()); | 123 ASSERT_TRUE(extension.get()); |
124 TestIconManager icon_manager(this); | 124 TestIconManager icon_manager(this); |
125 | 125 |
126 // Load the icon and grab the bitmap. | 126 // Load the icon and grab the bitmap. |
127 icon_manager.LoadIcon(profile.get(), extension.get()); | 127 icon_manager.LoadIcon(profile.get(), extension.get()); |
128 WaitForImageLoad(); | 128 WaitForImageLoad(); |
129 SkBitmap first_icon = icon_manager.GetIcon(extension->id()); | 129 SkBitmap first_icon = icon_manager.GetIcon(extension->id()); |
130 EXPECT_FALSE(gfx::BitmapsAreEqual(first_icon, default_icon)); | 130 EXPECT_FALSE(gfx::BitmapsAreEqual(first_icon, default_icon)); |
131 | 131 |
132 // Remove the icon from the manager. | 132 // Remove the icon from the manager. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // Now re-load the icon - we should get the same result bitmap (and not the | 177 // Now re-load the icon - we should get the same result bitmap (and not the |
178 // default icon). | 178 // default icon). |
179 icon_manager.LoadIcon(profile.get(), extension.get()); | 179 icon_manager.LoadIcon(profile.get(), extension.get()); |
180 WaitForImageLoad(); | 180 WaitForImageLoad(); |
181 SkBitmap second_icon = icon_manager.GetIcon(extension->id()); | 181 SkBitmap second_icon = icon_manager.GetIcon(extension->id()); |
182 EXPECT_FALSE(gfx::BitmapsAreEqual(second_icon, default_icon)); | 182 EXPECT_FALSE(gfx::BitmapsAreEqual(second_icon, default_icon)); |
183 | 183 |
184 EXPECT_TRUE(gfx::BitmapsAreEqual(first_icon, second_icon)); | 184 EXPECT_TRUE(gfx::BitmapsAreEqual(first_icon, second_icon)); |
185 } | 185 } |
186 #endif | 186 #endif |
OLD | NEW |