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

Side by Side Diff: extensions/browser/image_loader_unittest.cc

Issue 1389163008: Don't use base::MessageLoop::{Quit,QuitClosure} in extensions/, ipc/ (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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/image_loader.h" 5 #include "extensions/browser/image_loader.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/json/json_file_value_serializer.h" 8 #include "base/json/json_file_value_serializer.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 29 matching lines...) Expand all
40 : image_loaded_count_(0), 40 : image_loaded_count_(0),
41 quit_in_image_loaded_(false), 41 quit_in_image_loaded_(false),
42 ui_thread_(BrowserThread::UI, &ui_loop_), 42 ui_thread_(BrowserThread::UI, &ui_loop_),
43 file_thread_(BrowserThread::FILE), 43 file_thread_(BrowserThread::FILE),
44 io_thread_(BrowserThread::IO), 44 io_thread_(BrowserThread::IO),
45 notification_service_(NotificationService::Create()) {} 45 notification_service_(NotificationService::Create()) {}
46 46
47 void OnImageLoaded(const gfx::Image& image) { 47 void OnImageLoaded(const gfx::Image& image) {
48 image_loaded_count_++; 48 image_loaded_count_++;
49 if (quit_in_image_loaded_) 49 if (quit_in_image_loaded_)
50 base::MessageLoop::current()->Quit(); 50 base::MessageLoop::current()->QuitWhenIdle();
51 image_ = image; 51 image_ = image;
52 } 52 }
53 53
54 void OnImageFamilyLoaded(const gfx::ImageFamily& image_family) { 54 void OnImageFamilyLoaded(const gfx::ImageFamily& image_family) {
55 image_loaded_count_++; 55 image_loaded_count_++;
56 if (quit_in_image_loaded_) 56 if (quit_in_image_loaded_)
57 base::MessageLoop::current()->Quit(); 57 base::MessageLoop::current()->QuitWhenIdle();
58 image_family_ = image_family; 58 image_family_ = image_family;
59 } 59 }
60 60
61 void WaitForImageLoad() { 61 void WaitForImageLoad() {
62 quit_in_image_loaded_ = true; 62 quit_in_image_loaded_ = true;
63 base::MessageLoop::current()->Run(); 63 base::MessageLoop::current()->Run();
64 quit_in_image_loaded_ = false; 64 quit_in_image_loaded_ = false;
65 } 65 }
66 66
67 int image_loaded_count() { 67 int image_loaded_count() {
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 302
303 const gfx::ImageSkiaRep* img_rep1 = &image_reps[0]; 303 const gfx::ImageSkiaRep* img_rep1 = &image_reps[0];
304 const gfx::ImageSkiaRep* img_rep2 = &image_reps[1]; 304 const gfx::ImageSkiaRep* img_rep2 = &image_reps[1];
305 EXPECT_EQ(extension_misc::EXTENSION_ICON_BITTY, img_rep1->pixel_width()); 305 EXPECT_EQ(extension_misc::EXTENSION_ICON_BITTY, img_rep1->pixel_width());
306 EXPECT_EQ(1.0f, img_rep1->scale()); 306 EXPECT_EQ(1.0f, img_rep1->scale());
307 EXPECT_EQ(extension_misc::EXTENSION_ICON_SMALLISH, img_rep2->pixel_width()); 307 EXPECT_EQ(extension_misc::EXTENSION_ICON_SMALLISH, img_rep2->pixel_width());
308 EXPECT_EQ(2.0f, img_rep2->scale()); 308 EXPECT_EQ(2.0f, img_rep2->scale());
309 } 309 }
310 310
311 } // namespace extensions 311 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/file_reader_unittest.cc ('k') | extensions/browser/value_store/value_store_frontend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698