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

Side by Side Diff: ui/views/widget/native_widget_mac_unittest.mm

Issue 2054573002: Remove MessageLoop::current()->task_runner() in ui. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
« no previous file with comments | « ui/snapshot/screenshot_grabber.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #import "ui/views/widget/native_widget_mac.h" 5 #import "ui/views/widget/native_widget_mac.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/location.h"
9 #import "base/mac/foundation_util.h" 10 #import "base/mac/foundation_util.h"
10 #import "base/mac/scoped_nsobject.h" 11 #import "base/mac/scoped_nsobject.h"
11 #import "base/mac/scoped_nsautorelease_pool.h" 12 #import "base/mac/scoped_nsautorelease_pool.h"
12 #import "base/mac/scoped_objc_class_swizzler.h" 13 #import "base/mac/scoped_objc_class_swizzler.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/run_loop.h" 15 #include "base/run_loop.h"
16 #include "base/single_thread_task_runner.h"
15 #include "base/strings/sys_string_conversions.h" 17 #include "base/strings/sys_string_conversions.h"
16 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
17 #include "base/test/test_timeouts.h" 19 #include "base/test/test_timeouts.h"
20 #include "base/threading/thread_task_runner_handle.h"
18 #import "testing/gtest_mac.h" 21 #import "testing/gtest_mac.h"
19 #include "third_party/skia/include/core/SkBitmap.h" 22 #include "third_party/skia/include/core/SkBitmap.h"
20 #include "third_party/skia/include/core/SkCanvas.h" 23 #include "third_party/skia/include/core/SkCanvas.h"
21 #import "ui/base/cocoa/constrained_window/constrained_window_animation.h" 24 #import "ui/base/cocoa/constrained_window/constrained_window_animation.h"
22 #import "ui/base/cocoa/window_size_constants.h" 25 #import "ui/base/cocoa/window_size_constants.h"
23 #import "ui/base/test/scoped_fake_full_keyboard_access.h" 26 #import "ui/base/test/scoped_fake_full_keyboard_access.h"
24 #import "ui/events/test/cocoa_test_event_utils.h" 27 #import "ui/events/test/cocoa_test_event_utils.h"
25 #include "ui/events/test/event_generator.h" 28 #include "ui/events/test/event_generator.h"
26 #import "ui/gfx/mac/coordinate_conversion.h" 29 #import "ui/gfx/mac/coordinate_conversion.h"
27 #include "ui/views/bubble/bubble_dialog_delegate.h" 30 #include "ui/views/bubble/bubble_dialog_delegate.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 190
188 void WaitForVisibleCounts(int gained, int lost) { 191 void WaitForVisibleCounts(int gained, int lost) {
189 if (gained_visible_count_ >= gained && lost_visible_count_ >= lost) 192 if (gained_visible_count_ >= gained && lost_visible_count_ >= lost)
190 return; 193 return;
191 194
192 target_gained_visible_count_ = gained; 195 target_gained_visible_count_ = gained;
193 target_lost_visible_count_ = lost; 196 target_lost_visible_count_ = lost;
194 197
195 base::RunLoop run_loop; 198 base::RunLoop run_loop;
196 run_loop_ = &run_loop; 199 run_loop_ = &run_loop;
197 base::MessageLoop::current()->task_runner()->PostDelayedTask( 200 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
198 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::action_timeout()); 201 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::action_timeout());
199 run_loop.Run(); 202 run_loop.Run();
200 run_loop_ = nullptr; 203 run_loop_ = nullptr;
201 } 204 }
202 205
203 int gained_visible_count() const { return gained_visible_count_; } 206 int gained_visible_count() const { return gained_visible_count_; }
204 int lost_visible_count() const { return lost_visible_count_; } 207 int lost_visible_count() const { return lost_visible_count_; }
205 208
206 private: 209 private:
207 // WidgetObserver: 210 // WidgetObserver:
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 793
791 static IMP GetMethodAndMarkCalled() { 794 static IMP GetMethodAndMarkCalled() {
792 return instance_->GetMethodInternal(); 795 return instance_->GetMethodInternal();
793 } 796 }
794 797
795 void WaitForMethod() { 798 void WaitForMethod() {
796 if (method_called_) 799 if (method_called_)
797 return; 800 return;
798 801
799 base::RunLoop run_loop; 802 base::RunLoop run_loop;
800 base::MessageLoop::current()->task_runner()->PostDelayedTask( 803 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
801 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::action_timeout()); 804 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::action_timeout());
802 run_loop_ = &run_loop; 805 run_loop_ = &run_loop;
803 run_loop.Run(); 806 run_loop.Run();
804 run_loop_ = nullptr; 807 run_loop_ = nullptr;
805 } 808 }
806 809
807 bool method_called() const { return method_called_; } 810 bool method_called() const { return method_called_; }
808 811
809 private: 812 private:
810 IMP GetMethodInternal() { 813 IMP GetMethodInternal() {
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 1652
1650 - (void)dealloc { 1653 - (void)dealloc {
1651 if (deallocFlag_) { 1654 if (deallocFlag_) {
1652 DCHECK(!*deallocFlag_); 1655 DCHECK(!*deallocFlag_);
1653 *deallocFlag_ = true; 1656 *deallocFlag_ = true;
1654 } 1657 }
1655 [super dealloc]; 1658 [super dealloc];
1656 } 1659 }
1657 1660
1658 @end 1661 @end
OLDNEW
« no previous file with comments | « ui/snapshot/screenshot_grabber.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698