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

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

Issue 1395103003: Don't use base::MessageLoop::{Quit,QuitClosure} in chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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/message_loop.h" 6 #include "base/message_loop/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 17 matching lines...) Expand all
28 waiting_(false), 28 waiting_(false),
29 ui_thread_(BrowserThread::UI, &ui_loop_), 29 ui_thread_(BrowserThread::UI, &ui_loop_),
30 file_thread_(BrowserThread::FILE), 30 file_thread_(BrowserThread::FILE),
31 io_thread_(BrowserThread::IO) {} 31 io_thread_(BrowserThread::IO) {}
32 32
33 ~ExtensionIconManagerTest() override {} 33 ~ExtensionIconManagerTest() override {}
34 34
35 void ImageLoadObserved() { 35 void ImageLoadObserved() {
36 unwaited_image_loads_++; 36 unwaited_image_loads_++;
37 if (waiting_) { 37 if (waiting_) {
38 base::MessageLoop::current()->Quit(); 38 base::MessageLoop::current()->QuitWhenIdle();
39 } 39 }
40 } 40 }
41 41
42 void WaitForImageLoad() { 42 void WaitForImageLoad() {
43 if (unwaited_image_loads_ == 0) { 43 if (unwaited_image_loads_ == 0) {
44 waiting_ = true; 44 waiting_ = true;
45 base::MessageLoop::current()->Run(); 45 base::MessageLoop::current()->Run();
46 waiting_ = false; 46 waiting_ = false;
47 } 47 }
48 ASSERT_GT(unwaited_image_loads_, 0); 48 ASSERT_GT(unwaited_image_loads_, 0);
(...skipping 127 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 176 // Now re-load the icon - we should get the same result bitmap (and not the
177 // default icon). 177 // default icon).
178 icon_manager.LoadIcon(profile.get(), extension.get()); 178 icon_manager.LoadIcon(profile.get(), extension.get());
179 WaitForImageLoad(); 179 WaitForImageLoad();
180 SkBitmap second_icon = icon_manager.GetIcon(extension->id()); 180 SkBitmap second_icon = icon_manager.GetIcon(extension->id());
181 EXPECT_FALSE(gfx::BitmapsAreEqual(second_icon, default_icon)); 181 EXPECT_FALSE(gfx::BitmapsAreEqual(second_icon, default_icon));
182 182
183 EXPECT_TRUE(gfx::BitmapsAreEqual(first_icon, second_icon)); 183 EXPECT_TRUE(gfx::BitmapsAreEqual(first_icon, second_icon));
184 } 184 }
185 #endif 185 #endif
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_function_test_utils.cc ('k') | chrome/browser/extensions/extension_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698