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

Side by Side Diff: ash/shelf/shelf_view_unittest.cc

Issue 2375663002: Replace MessageLoop::current()->task_runner() with ThreadTaskRunnerHandle::Get(). (Closed)
Patch Set: rebase Created 4 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
« no previous file with comments | « no previous file | base/memory/ref_counted_delete_on_message_loop.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ash/common/shelf/shelf_view.h" 5 #include "ash/common/shelf/shelf_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 2606 matching lines...) Expand 10 before | Expand all | Expand 10 after
2617 DISALLOW_COPY_AND_ASSIGN(TestOverflowButtonShellDelegate); 2617 DISALLOW_COPY_AND_ASSIGN(TestOverflowButtonShellDelegate);
2618 }; 2618 };
2619 2619
2620 // A scoped wrapper around TestMockTimeTaskRunner that replaces message loop's 2620 // A scoped wrapper around TestMockTimeTaskRunner that replaces message loop's
2621 // task runner with a TestMockTimeTaskRunner and resets it back at the end of 2621 // task runner with a TestMockTimeTaskRunner and resets it back at the end of
2622 // the scope. 2622 // the scope.
2623 class ScopedMockTaskRunnerWrapper { 2623 class ScopedMockTaskRunnerWrapper {
2624 public: 2624 public:
2625 ScopedMockTaskRunnerWrapper() { 2625 ScopedMockTaskRunnerWrapper() {
2626 mock_task_runner_ = new base::TestMockTimeTaskRunner; 2626 mock_task_runner_ = new base::TestMockTimeTaskRunner;
2627 previous_task_runner_ = base::MessageLoop::current()->task_runner(); 2627 previous_task_runner_ = base::ThreadTaskRunnerHandle::Get();
2628 base::MessageLoop::current()->SetTaskRunner(mock_task_runner_); 2628 base::MessageLoop::current()->SetTaskRunner(mock_task_runner_);
2629 } 2629 }
2630 2630
2631 ~ScopedMockTaskRunnerWrapper() { 2631 ~ScopedMockTaskRunnerWrapper() {
2632 DCHECK_EQ(mock_task_runner_, base::MessageLoop::current()->task_runner()); 2632 DCHECK_EQ(mock_task_runner_, base::ThreadTaskRunnerHandle::Get());
2633 mock_task_runner_->ClearPendingTasks(); 2633 mock_task_runner_->ClearPendingTasks();
2634 base::MessageLoop::current()->SetTaskRunner(previous_task_runner_); 2634 base::MessageLoop::current()->SetTaskRunner(previous_task_runner_);
2635 } 2635 }
2636 2636
2637 void FastForwardUntilNoTasksRemain() { 2637 void FastForwardUntilNoTasksRemain() {
2638 mock_task_runner_->FastForwardUntilNoTasksRemain(); 2638 mock_task_runner_->FastForwardUntilNoTasksRemain();
2639 } 2639 }
2640 2640
2641 private: 2641 private:
2642 scoped_refptr<base::TestMockTimeTaskRunner> mock_task_runner_; 2642 scoped_refptr<base::TestMockTimeTaskRunner> mock_task_runner_;
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
3171 IsEmpty()); 3171 IsEmpty());
3172 3172
3173 ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); 3173 ASSERT_TRUE(test_api_->IsShowingOverflowBubble());
3174 } 3174 }
3175 } 3175 }
3176 3176
3177 #endif // !defined(OS_WIN) 3177 #endif // !defined(OS_WIN)
3178 3178
3179 } // namespace test 3179 } // namespace test
3180 } // namespace ash 3180 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | base/memory/ref_counted_delete_on_message_loop.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698