Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Side by Side Diff: chrome/browser/extensions/extension_icon_manager_unittest.cc

Issue 12213093: Remove ImageLoadingTracker class (Closed) Base URL: https://git.chromium.org/chromium/src.git@Issue_163929
Patch Set: Fix merge conflict Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
69 DISALLOW_COPY_AND_ASSIGN(ExtensionIconManagerTest); 69 DISALLOW_COPY_AND_ASSIGN(ExtensionIconManagerTest);
70 }; 70 };
71 71
72 // This is a specialization of ExtensionIconManager, with a special override to 72 // This is a specialization of ExtensionIconManager, with a special override to
73 // call back to the test when an icon has completed loading. 73 // call back to the test when an icon has completed loading.
74 class TestIconManager : public ExtensionIconManager { 74 class TestIconManager : public ExtensionIconManager {
75 public: 75 public:
76 explicit TestIconManager(ExtensionIconManagerTest* test) : test_(test) {} 76 explicit TestIconManager(ExtensionIconManagerTest* test) : test_(test) {}
77 virtual ~TestIconManager() {} 77 virtual ~TestIconManager() {}
78 78
79 // Implements the ImageLoadingTracker::Observer interface, and calls through 79 // Overrides the ImageLoader callback, and calls through to the base class'
80 // to the base class' implementation. Then it lets the test know that an 80 // implementation. Then it lets the test know that an image load was observed.
81 // image load was observed.
82 virtual void OnImageLoaded(const std::string& extension_id, 81 virtual void OnImageLoaded(const std::string& extension_id,
83 const gfx::Image& image) OVERRIDE { 82 const gfx::Image& image) OVERRIDE {
84 ExtensionIconManager::OnImageLoaded(extension_id, image); 83 ExtensionIconManager::OnImageLoaded(extension_id, image);
85 test_->ImageLoadObserved(); 84 test_->ImageLoadObserved();
86 } 85 }
87 86
88 private: 87 private:
89 ExtensionIconManagerTest* test_; 88 ExtensionIconManagerTest* test_;
90 89
91 DISALLOW_COPY_AND_ASSIGN(TestIconManager); 90 DISALLOW_COPY_AND_ASSIGN(TestIconManager);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 // Now re-load the icon - we should get the same result bitmap (and not the 175 // Now re-load the icon - we should get the same result bitmap (and not the
177 // default icon). 176 // default icon).
178 icon_manager.LoadIcon(profile.get(), extension.get()); 177 icon_manager.LoadIcon(profile.get(), extension.get());
179 WaitForImageLoad(); 178 WaitForImageLoad();
180 SkBitmap second_icon = icon_manager.GetIcon(extension->id()); 179 SkBitmap second_icon = icon_manager.GetIcon(extension->id());
181 EXPECT_FALSE(gfx::BitmapsAreEqual(second_icon, default_icon)); 180 EXPECT_FALSE(gfx::BitmapsAreEqual(second_icon, default_icon));
182 181
183 EXPECT_TRUE(gfx::BitmapsAreEqual(first_icon, second_icon)); 182 EXPECT_TRUE(gfx::BitmapsAreEqual(first_icon, second_icon));
184 } 183 }
185 #endif 184 #endif
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_icon_image.cc ('k') | chrome/browser/extensions/image_loading_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698