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

Side by Side Diff: chrome/browser/ui/views/menu_model_adapter_test.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
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/callback.h" 5 #include "base/callback.h"
6 #include "base/location.h" 6 #include "base/location.h"
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 // Rebuild the menu which should close the submenu. 227 // Rebuild the menu which should close the submenu.
228 void Step2() { 228 void Step2() {
229 views::SubmenuView* topmenu = menu_->GetSubmenu(); 229 views::SubmenuView* topmenu = menu_->GetSubmenu();
230 ASSERT_TRUE(topmenu); 230 ASSERT_TRUE(topmenu);
231 ASSERT_TRUE(topmenu->IsShowing()); 231 ASSERT_TRUE(topmenu->IsShowing());
232 ASSERT_TRUE(top_menu_model_.IsSubmenuShowing()); 232 ASSERT_TRUE(top_menu_model_.IsSubmenuShowing());
233 233
234 menu_model_adapter_.BuildMenu(menu_); 234 menu_model_adapter_.BuildMenu(menu_);
235 235
236 base::MessageLoopForUI::current()->task_runner()->PostTask( 236 ASSERT_TRUE(base::MessageLoopForUI::IsCurrent());
237 base::ThreadTaskRunnerHandle::Get()->PostTask(
237 FROM_HERE, CreateEventTask(this, &MenuModelAdapterTest::Step3)); 238 FROM_HERE, CreateEventTask(this, &MenuModelAdapterTest::Step3));
238 } 239 }
239 240
240 // Verify that the submenu MenuModel received the close callback 241 // Verify that the submenu MenuModel received the close callback
241 // and close the menu. 242 // and close the menu.
242 void Step3() { 243 void Step3() {
243 views::SubmenuView* topmenu = menu_->GetSubmenu(); 244 views::SubmenuView* topmenu = menu_->GetSubmenu();
244 ASSERT_TRUE(topmenu); 245 ASSERT_TRUE(topmenu);
245 ASSERT_TRUE(topmenu->IsShowing()); 246 ASSERT_TRUE(topmenu->IsShowing());
246 ASSERT_FALSE(top_menu_model_.IsSubmenuShowing()); 247 ASSERT_FALSE(top_menu_model_.IsSubmenuShowing());
(...skipping 24 matching lines...) Expand all
271 272
272 views::MenuButton* button_; 273 views::MenuButton* button_;
273 TopMenuModel top_menu_model_; 274 TopMenuModel top_menu_model_;
274 views::MenuModelAdapter menu_model_adapter_; 275 views::MenuModelAdapter menu_model_adapter_;
275 views::MenuItemView* menu_; 276 views::MenuItemView* menu_;
276 std::unique_ptr<views::MenuRunner> menu_runner_; 277 std::unique_ptr<views::MenuRunner> menu_runner_;
277 }; 278 };
278 279
279 // If this flakes, disable and log details in http://crbug.com/523255. 280 // If this flakes, disable and log details in http://crbug.com/523255.
280 VIEW_TEST(MenuModelAdapterTest, RebuildMenu) 281 VIEW_TEST(MenuModelAdapterTest, RebuildMenu)
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/chrome_views_delegate.cc ('k') | components/arc/arc_bridge_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698