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

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

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 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 | Annotate | Revision Log
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 "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/file_util.h" 8 #include "base/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.h" 10 #include "base/message_loop.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 : quit_in_icon_updated_(false), 88 : quit_in_icon_updated_(false),
89 ui_thread_(BrowserThread::UI, &ui_loop_), 89 ui_thread_(BrowserThread::UI, &ui_loop_),
90 file_thread_(BrowserThread::FILE), 90 file_thread_(BrowserThread::FILE),
91 io_thread_(BrowserThread::IO) { 91 io_thread_(BrowserThread::IO) {
92 } 92 }
93 93
94 virtual ~ExtensionActionIconFactoryTest() {} 94 virtual ~ExtensionActionIconFactoryTest() {}
95 95
96 void WaitForIconUpdate() { 96 void WaitForIconUpdate() {
97 quit_in_icon_updated_ = true; 97 quit_in_icon_updated_ = true;
98 MessageLoop::current()->Run(); 98 base::MessageLoop::current()->Run();
99 quit_in_icon_updated_ = false; 99 quit_in_icon_updated_ = false;
100 } 100 }
101 101
102 scoped_refptr<Extension> CreateExtension(const char* name, 102 scoped_refptr<Extension> CreateExtension(const char* name,
103 Manifest::Location location) { 103 Manifest::Location location) {
104 // Create and load an extension. 104 // Create and load an extension.
105 base::FilePath test_file; 105 base::FilePath test_file;
106 if (!PathService::Get(chrome::DIR_TEST_DATA, &test_file)) { 106 if (!PathService::Get(chrome::DIR_TEST_DATA, &test_file)) {
107 EXPECT_FALSE(true); 107 EXPECT_FALSE(true);
108 return NULL; 108 return NULL;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 143 }
144 144
145 virtual void TearDown() OVERRIDE { 145 virtual void TearDown() OVERRIDE {
146 profile_.reset(); // Get all DeleteSoon calls sent to ui_loop_. 146 profile_.reset(); // Get all DeleteSoon calls sent to ui_loop_.
147 ui_loop_.RunUntilIdle(); 147 ui_loop_.RunUntilIdle();
148 } 148 }
149 149
150 // ExtensionActionIconFactory::Observer overrides: 150 // ExtensionActionIconFactory::Observer overrides:
151 virtual void OnIconUpdated() OVERRIDE { 151 virtual void OnIconUpdated() OVERRIDE {
152 if (quit_in_icon_updated_) 152 if (quit_in_icon_updated_)
153 MessageLoop::current()->Quit(); 153 base::MessageLoop::current()->Quit();
154 } 154 }
155 155
156 gfx::ImageSkia GetFavicon() { 156 gfx::ImageSkia GetFavicon() {
157 return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 157 return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
158 IDR_EXTENSIONS_FAVICON); 158 IDR_EXTENSIONS_FAVICON);
159 } 159 }
160 160
161 ExtensionAction* GetBrowserAction(const Extension& extension) { 161 ExtensionAction* GetBrowserAction(const Extension& extension) {
162 return ExtensionActionManager::Get(profile())->GetBrowserAction(extension); 162 return ExtensionActionManager::Get(profile())->GetBrowserAction(extension);
163 } 163 }
164 164
165 TestingProfile* profile() { return profile_.get(); } 165 TestingProfile* profile() { return profile_.get(); }
166 166
167 private: 167 private:
168 bool quit_in_icon_updated_; 168 bool quit_in_icon_updated_;
169 MessageLoop ui_loop_; 169 base::MessageLoop ui_loop_;
170 content::TestBrowserThread ui_thread_; 170 content::TestBrowserThread ui_thread_;
171 content::TestBrowserThread file_thread_; 171 content::TestBrowserThread file_thread_;
172 content::TestBrowserThread io_thread_; 172 content::TestBrowserThread io_thread_;
173 scoped_ptr<TestingProfile> profile_; 173 scoped_ptr<TestingProfile> profile_;
174 ExtensionService* extension_service_; 174 ExtensionService* extension_service_;
175 175
176 #if defined OS_CHROMEOS 176 #if defined OS_CHROMEOS
177 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; 177 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_;
178 chromeos::ScopedTestCrosSettings test_cros_settings_; 178 chromeos::ScopedTestCrosSettings test_cros_settings_;
179 chromeos::ScopedTestUserManager test_user_manager_; 179 chromeos::ScopedTestUserManager test_user_manager_;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 icon = icon_factory.GetIcon(1); 293 icon = icon_factory.GetIcon(1);
294 294
295 EXPECT_TRUE(ImageRepsAreEqual( 295 EXPECT_TRUE(ImageRepsAreEqual(
296 default_icon.ToImageSkia()->GetRepresentation(ui::SCALE_FACTOR_100P), 296 default_icon.ToImageSkia()->GetRepresentation(ui::SCALE_FACTOR_100P),
297 icon.ToImageSkia()->GetRepresentation(ui::SCALE_FACTOR_100P))); 297 icon.ToImageSkia()->GetRepresentation(ui::SCALE_FACTOR_100P)));
298 298
299 } 299 }
300 300
301 } // namespace 301 } // namespace
302 } // namespace extensions 302 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_action.cc ('k') | chrome/browser/extensions/extension_action_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698