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/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/extensions/extension_icon_manager.h" | 9 #include "chrome/browser/extensions/extension_icon_manager.h" |
10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // This is a specialization of ExtensionIconManager, with a special override to | 69 // This is a specialization of ExtensionIconManager, with a special override to |
70 // call back to the test when an icon has completed loading. | 70 // call back to the test when an icon has completed loading. |
71 class TestIconManager : public ExtensionIconManager { | 71 class TestIconManager : public ExtensionIconManager { |
72 public: | 72 public: |
73 explicit TestIconManager(ExtensionIconManagerTest* test) : test_(test) {} | 73 explicit TestIconManager(ExtensionIconManagerTest* test) : test_(test) {} |
74 virtual ~TestIconManager() {} | 74 virtual ~TestIconManager() {} |
75 | 75 |
76 // Implements the ImageLoadingTracker::Observer interface, and calls through | 76 // Implements the ImageLoadingTracker::Observer interface, and calls through |
77 // to the base class' implementation. Then it lets the test know that an | 77 // to the base class' implementation. Then it lets the test know that an |
78 // image load was observed. | 78 // image load was observed. |
79 virtual void OnImageLoaded(SkBitmap* image, const ExtensionResource& resource, | 79 virtual void OnImageLoaded(const gfx::Image& image, |
80 int index) { | 80 const std::string& extension_id, |
81 ExtensionIconManager::OnImageLoaded(image, resource, index); | 81 int index) OVERRIDE { |
| 82 ExtensionIconManager::OnImageLoaded(image, extension_id, index); |
82 test_->ImageLoadObserved(); | 83 test_->ImageLoadObserved(); |
83 } | 84 } |
84 | 85 |
85 private: | 86 private: |
86 ExtensionIconManagerTest* test_; | 87 ExtensionIconManagerTest* test_; |
87 | 88 |
88 DISALLOW_COPY_AND_ASSIGN(TestIconManager); | 89 DISALLOW_COPY_AND_ASSIGN(TestIconManager); |
89 }; | 90 }; |
90 | 91 |
91 // Returns the default icon that ExtensionIconManager gives when an extension | 92 // Returns the default icon that ExtensionIconManager gives when an extension |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 130 |
130 // Now re-load the icon - we should get the same result bitmap (and not the | 131 // Now re-load the icon - we should get the same result bitmap (and not the |
131 // default icon). | 132 // default icon). |
132 icon_manager.LoadIcon(extension.get()); | 133 icon_manager.LoadIcon(extension.get()); |
133 WaitForImageLoad(); | 134 WaitForImageLoad(); |
134 SkBitmap second_icon = icon_manager.GetIcon(extension->id()); | 135 SkBitmap second_icon = icon_manager.GetIcon(extension->id()); |
135 EXPECT_FALSE(gfx::BitmapsAreEqual(second_icon, default_icon)); | 136 EXPECT_FALSE(gfx::BitmapsAreEqual(second_icon, default_icon)); |
136 | 137 |
137 EXPECT_TRUE(gfx::BitmapsAreEqual(first_icon, second_icon)); | 138 EXPECT_TRUE(gfx::BitmapsAreEqual(first_icon, second_icon)); |
138 } | 139 } |
OLD | NEW |