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

Side by Side Diff: chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc

Issue 1160073004: chrome/browser/ui: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check for task runner instead of current message loop. Created 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/shelf/shelf.h" 5 #include "ash/shelf/shelf.h"
6 #include "ash/shelf/shelf_view.h" 6 #include "ash/shelf/shelf_view.h"
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/test/shelf_test_api.h" 8 #include "ash/test/shelf_test_api.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/location.h"
11 #include "base/single_thread_task_runner.h"
12 #include "base/thread_task_runner_handle.h"
11 #include "chrome/browser/lifetime/application_lifetime.h" 13 #include "chrome/browser/lifetime/application_lifetime.h"
12 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_list.h" 15 #include "chrome/browser/ui/browser_list.h"
14 #include "chrome/browser/ui/browser_window.h" 16 #include "chrome/browser/ui/browser_window.h"
15 #include "chrome/test/base/in_process_browser_test.h" 17 #include "chrome/test/base/in_process_browser_test.h"
16 #include "ui/aura/window_event_dispatcher.h" 18 #include "ui/aura/window_event_dispatcher.h"
17 #include "ui/base/test/ui_controls.h" 19 #include "ui/base/test/ui_controls.h"
18 #include "ui/events/test/event_generator.h" 20 #include "ui/events/test/event_generator.h"
19 #include "ui/views/controls/menu/menu_controller.h" 21 #include "ui/views/controls/menu/menu_controller.h"
20 #include "ui/views/view.h" 22 #include "ui/views/view.h"
(...skipping 12 matching lines...) Expand all
33 command_line->AppendSwitchASCII("ash-host-window-bounds", 35 command_line->AppendSwitchASCII("ash-host-window-bounds",
34 "600x600,601+0-600x600"); 36 "600x600,601+0-600x600");
35 } 37 }
36 38
37 private: 39 private:
38 DISALLOW_COPY_AND_ASSIGN(WindowSizerTest); 40 DISALLOW_COPY_AND_ASSIGN(WindowSizerTest);
39 }; 41 };
40 42
41 void CloseBrowser(Browser* browser) { 43 void CloseBrowser(Browser* browser) {
42 browser->window()->Close(); 44 browser->window()->Close();
43 base::MessageLoop::current()->RunUntilIdle(); 45 base::MessageLoop::current()->RunUntilIdle();
msw 2015/06/10 00:12:58 Is this correct? Please check other files for base
Sami 2015/06/10 12:35:34 Yes, this is still correct[1]: you can't call Run
44 } 46 }
45 47
46 gfx::Rect GetChromeIconBoundsForRootWindow(aura::Window* root_window) { 48 gfx::Rect GetChromeIconBoundsForRootWindow(aura::Window* root_window) {
47 ash::Shelf* shelf = ash::Shelf::ForWindow(root_window); 49 ash::Shelf* shelf = ash::Shelf::ForWindow(root_window);
48 const ash::ShelfView* shelf_view = 50 const ash::ShelfView* shelf_view =
49 ash::test::ShelfTestAPI(shelf).shelf_view(); 51 ash::test::ShelfTestAPI(shelf).shelf_view();
50 const views::ViewModel* view_model = shelf_view->view_model_for_test(); 52 const views::ViewModel* view_model = shelf_view->view_model_for_test();
51 53
52 EXPECT_EQ(2, view_model->view_size()); 54 EXPECT_EQ(2, view_model->view_size());
53 return view_model->view_at(1)->GetBoundsInScreen(); 55 return view_model->view_at(1)->GetBoundsInScreen();
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 base::Bind(&WindowSizerContextMenuTest::Step3)); 136 base::Bind(&WindowSizerContextMenuTest::Step3));
135 } 137 }
136 138
137 static void Step3() { 139 static void Step3() {
138 ui_controls::SendMouseEventsNotifyWhenDone( 140 ui_controls::SendMouseEventsNotifyWhenDone(
139 ui_controls::RIGHT, ui_controls::UP, 141 ui_controls::RIGHT, ui_controls::UP,
140 base::Bind(&WindowSizerContextMenuTest::QuitLoop)); 142 base::Bind(&WindowSizerContextMenuTest::QuitLoop));
141 } 143 }
142 144
143 static void QuitLoop() { 145 static void QuitLoop() {
144 base::MessageLoop::current()->PostTask( 146 base::ThreadTaskRunnerHandle::Get()->PostTask(
145 FROM_HERE, 147 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
msw 2015/06/10 00:12:58 Is this still correct? Maybe update the QuitLoop()
Sami 2015/06/10 12:35:34 Yes, this is still exiting the message loop for th
146 base::MessageLoop::QuitWhenIdleClosure());
147 } 148 }
148 149
149 private: 150 private:
150 DISALLOW_COPY_AND_ASSIGN(WindowSizerContextMenuTest); 151 DISALLOW_COPY_AND_ASSIGN(WindowSizerContextMenuTest);
151 }; 152 };
152 153
153 void OpenBrowserUsingContextMenuOnRootWindow(aura::Window* root_window) { 154 void OpenBrowserUsingContextMenuOnRootWindow(aura::Window* root_window) {
154 gfx::Point chrome_icon = 155 gfx::Point chrome_icon =
155 GetChromeIconBoundsForRootWindow(root_window).CenterPoint(); 156 GetChromeIconBoundsForRootWindow(root_window).CenterPoint();
156 gfx::Point release_point = chrome_icon; 157 gfx::Point release_point = chrome_icon;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 192
192 // Next new browser must be created on 1st display. 193 // Next new browser must be created on 1st display.
193 ASSERT_EQ(2u, browser_list->size()); 194 ASSERT_EQ(2u, browser_list->size());
194 EXPECT_EQ(root_windows[0], 195 EXPECT_EQ(root_windows[0],
195 browser_list->get(1)->window()->GetNativeWindow()->GetRootWindow()); 196 browser_list->get(1)->window()->GetNativeWindow()->GetRootWindow());
196 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); 197 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow());
197 198
198 // Balanced with the chrome::IncrementKeepAliveCount above. 199 // Balanced with the chrome::IncrementKeepAliveCount above.
199 chrome::DecrementKeepAliveCount(); 200 chrome::DecrementKeepAliveCount();
200 } 201 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698