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

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

Issue 2083363002: Remove calls to deprecated MessageLoop methods in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/json/json_file_value_serializer.h" 11 #include "base/json/json_file_value_serializer.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/run_loop.h"
15 #include "build/build_config.h" 16 #include "build/build_config.h"
16 #include "chrome/browser/extensions/extension_action.h" 17 #include "chrome/browser/extensions/extension_action.h"
17 #include "chrome/browser/extensions/extension_action_manager.h" 18 #include "chrome/browser/extensions/extension_action_manager.h"
18 #include "chrome/browser/extensions/extension_service.h" 19 #include "chrome/browser/extensions/extension_service.h"
19 #include "chrome/browser/extensions/test_extension_system.h" 20 #include "chrome/browser/extensions/test_extension_system.h"
20 #include "chrome/common/chrome_paths.h" 21 #include "chrome/common/chrome_paths.h"
21 #include "chrome/test/base/testing_profile.h" 22 #include "chrome/test/base/testing_profile.h"
22 #include "content/public/test/test_browser_thread.h" 23 #include "content/public/test/test_browser_thread.h"
23 #include "extensions/common/extension.h" 24 #include "extensions/common/extension.h"
24 #include "grit/theme_resources.h" 25 #include "grit/theme_resources.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 : quit_in_icon_updated_(false), 92 : quit_in_icon_updated_(false),
92 ui_thread_(BrowserThread::UI, &ui_loop_), 93 ui_thread_(BrowserThread::UI, &ui_loop_),
93 file_thread_(BrowserThread::FILE), 94 file_thread_(BrowserThread::FILE),
94 io_thread_(BrowserThread::IO) { 95 io_thread_(BrowserThread::IO) {
95 } 96 }
96 97
97 ~ExtensionActionIconFactoryTest() override {} 98 ~ExtensionActionIconFactoryTest() override {}
98 99
99 void WaitForIconUpdate() { 100 void WaitForIconUpdate() {
100 quit_in_icon_updated_ = true; 101 quit_in_icon_updated_ = true;
101 base::MessageLoop::current()->Run(); 102 base::RunLoop().Run();
102 quit_in_icon_updated_ = false; 103 quit_in_icon_updated_ = false;
103 } 104 }
104 105
105 scoped_refptr<Extension> CreateExtension(const char* name, 106 scoped_refptr<Extension> CreateExtension(const char* name,
106 Manifest::Location location) { 107 Manifest::Location location) {
107 // Create and load an extension. 108 // Create and load an extension.
108 base::FilePath test_file; 109 base::FilePath test_file;
109 if (!PathService::Get(chrome::DIR_TEST_DATA, &test_file)) { 110 if (!PathService::Get(chrome::DIR_TEST_DATA, &test_file)) {
110 EXPECT_FALSE(true); 111 EXPECT_FALSE(true);
111 return NULL; 112 return NULL;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 extension_service_ = static_cast<extensions::TestExtensionSystem*>( 145 extension_service_ = static_cast<extensions::TestExtensionSystem*>(
145 extensions::ExtensionSystem::Get(profile_.get()))-> 146 extensions::ExtensionSystem::Get(profile_.get()))->
146 CreateExtensionService(&command_line, base::FilePath(), false); 147 CreateExtensionService(&command_line, base::FilePath(), false);
147 material_design_state_.reset( 148 material_design_state_.reset(
148 new ui::test::MaterialDesignControllerTestAPI(GetParam())); 149 new ui::test::MaterialDesignControllerTestAPI(GetParam()));
149 } 150 }
150 151
151 void TearDown() override { 152 void TearDown() override {
152 material_design_state_.reset(); 153 material_design_state_.reset();
153 profile_.reset(); // Get all DeleteSoon calls sent to ui_loop_. 154 profile_.reset(); // Get all DeleteSoon calls sent to ui_loop_.
154 ui_loop_.RunUntilIdle(); 155 base::RunLoop().RunUntilIdle();
155 } 156 }
156 157
157 // ExtensionActionIconFactory::Observer overrides: 158 // ExtensionActionIconFactory::Observer overrides:
158 void OnIconUpdated() override { 159 void OnIconUpdated() override {
159 if (quit_in_icon_updated_) 160 if (quit_in_icon_updated_)
160 base::MessageLoop::current()->QuitWhenIdle(); 161 base::MessageLoop::current()->QuitWhenIdle();
161 } 162 }
162 163
163 gfx::ImageSkia GetFavicon() { 164 gfx::ImageSkia GetFavicon() {
164 return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 165 return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 icon = icon_factory.GetIcon(1); 311 icon = icon_factory.GetIcon(1);
311 312
312 EXPECT_TRUE(ImageRepsAreEqual( 313 EXPECT_TRUE(ImageRepsAreEqual(
313 default_icon.ToImageSkia()->GetRepresentation(1.0f), 314 default_icon.ToImageSkia()->GetRepresentation(1.0f),
314 icon.ToImageSkia()->GetRepresentation(1.0f))); 315 icon.ToImageSkia()->GetRepresentation(1.0f)));
315 316
316 } 317 }
317 318
318 } // namespace 319 } // namespace
319 } // namespace extensions 320 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/app_data_migrator_unittest.cc ('k') | chrome/browser/extensions/extension_icon_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698