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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc

Issue 2824363002: Rewrite base::Bind to base::BindOnce with base_bind_rewriters in //chrome/browser/ui (Closed)
Patch Set: Created 3 years, 8 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/bind.h" 5 #include "base/bind.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 views::View::ConvertPointToScreen(scroll_down_button, &loc); 1049 views::View::ConvertPointToScreen(scroll_down_button, &loc);
1050 1050
1051 // On linux, the sending one location isn't enough. 1051 // On linux, the sending one location isn't enough.
1052 ASSERT_TRUE(ui_controls::SendMouseMove(loc.x() - 1, loc.y() - 1)); 1052 ASSERT_TRUE(ui_controls::SendMouseMove(loc.x() - 1, loc.y() - 1));
1053 ASSERT_TRUE(ui_controls::SendMouseMoveNotifyWhenDone( 1053 ASSERT_TRUE(ui_controls::SendMouseMoveNotifyWhenDone(
1054 loc.x(), loc.y(), CreateEventTask(this, &BookmarkBarViewTest9::Step3))); 1054 loc.x(), loc.y(), CreateEventTask(this, &BookmarkBarViewTest9::Step3)));
1055 } 1055 }
1056 1056
1057 void Step3() { 1057 void Step3() {
1058 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 1058 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
1059 FROM_HERE, base::Bind(&BookmarkBarViewTest9::Step4, this), 1059 FROM_HERE, base::BindOnce(&BookmarkBarViewTest9::Step4, this),
1060 base::TimeDelta::FromMilliseconds(200)); 1060 base::TimeDelta::FromMilliseconds(200));
1061 } 1061 }
1062 1062
1063 void Step4() { 1063 void Step4() {
1064 gfx::Point menu_loc; 1064 gfx::Point menu_loc;
1065 views::View::ConvertPointToScreen(first_menu_, &menu_loc); 1065 views::View::ConvertPointToScreen(first_menu_, &menu_loc);
1066 ASSERT_NE(start_y_, menu_loc.y()); 1066 ASSERT_NE(start_y_, menu_loc.y());
1067 1067
1068 // Hide menu. 1068 // Hide menu.
1069 bb_view_->GetMenu()->GetMenuController()->CancelAll(); 1069 bb_view_->GetMenu()->GetMenuController()->CancelAll();
1070 1070
1071 // On linux, Cancelling menu will call Quit on the message loop, 1071 // On linux, Cancelling menu will call Quit on the message loop,
1072 // which can interfere with Done. We need to run Done in the 1072 // which can interfere with Done. We need to run Done in the
1073 // next execution loop. 1073 // next execution loop.
1074 base::ThreadTaskRunnerHandle::Get()->PostTask( 1074 base::ThreadTaskRunnerHandle::Get()->PostTask(
1075 FROM_HERE, base::Bind(&ViewEventTestBase::Done, this)); 1075 FROM_HERE, base::BindOnce(&ViewEventTestBase::Done, this));
1076 } 1076 }
1077 1077
1078 int start_y_; 1078 int start_y_;
1079 views::MenuItemView* first_menu_; 1079 views::MenuItemView* first_menu_;
1080 }; 1080 };
1081 1081
1082 // Fails on official cros bot. crbug.com/431427. 1082 // Fails on official cros bot. crbug.com/431427.
1083 #if defined(OS_CHROMEOS) && defined(OFFICIAL_BUILD) 1083 #if defined(OS_CHROMEOS) && defined(OFFICIAL_BUILD)
1084 #define MAYBE_ScrollButtonScrolls DISABLED_ScrollButtonScrolls 1084 #define MAYBE_ScrollButtonScrolls DISABLED_ScrollButtonScrolls
1085 #else 1085 #else
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 1360
1361 // Press tab to give focus to the cancel button. Wait until the widget 1361 // Press tab to give focus to the cancel button. Wait until the widget
1362 // receives the tab key. 1362 // receives the tab key.
1363 TabKeyWaiter tab_waiter(dialog); 1363 TabKeyWaiter tab_waiter(dialog);
1364 ASSERT_TRUE(ui_controls::SendKeyPress( 1364 ASSERT_TRUE(ui_controls::SendKeyPress(
1365 window_->GetNativeWindow(), ui::VKEY_TAB, false, false, false, false)); 1365 window_->GetNativeWindow(), ui::VKEY_TAB, false, false, false, false));
1366 tab_waiter.WaitForTab(); 1366 tab_waiter.WaitForTab();
1367 1367
1368 // For some reason return isn't processed correctly unless we delay. 1368 // For some reason return isn't processed correctly unless we delay.
1369 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 1369 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
1370 FROM_HERE, base::Bind(&BookmarkBarViewTest12::Step5, this, 1370 FROM_HERE,
1371 base::Unretained(dialog)), 1371 base::BindOnce(&BookmarkBarViewTest12::Step5, this,
1372 base::Unretained(dialog)),
1372 base::TimeDelta::FromSeconds(1)); 1373 base::TimeDelta::FromSeconds(1));
1373 } 1374 }
1374 1375
1375 void Step5(views::Widget* dialog) { 1376 void Step5(views::Widget* dialog) {
1376 DialogCloseWaiter waiter(dialog); 1377 DialogCloseWaiter waiter(dialog);
1377 // And press enter so that the cancel button is selected. 1378 // And press enter so that the cancel button is selected.
1378 ASSERT_TRUE(ui_controls::SendKeyPressNotifyWhenDone( 1379 ASSERT_TRUE(ui_controls::SendKeyPressNotifyWhenDone(
1379 window_->GetNativeWindow(), ui::VKEY_RETURN, false, false, false, false, 1380 window_->GetNativeWindow(), ui::VKEY_RETURN, false, false, false, false,
1380 base::Closure())); 1381 base::Closure()));
1381 waiter.WaitForDialogClose(); 1382 waiter.WaitForDialogClose();
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
2377 ASSERT_EQ(2u, navigator_.urls().size()); 2378 ASSERT_EQ(2u, navigator_.urls().size());
2378 EXPECT_EQ(navigator_.urls()[0], 2379 EXPECT_EQ(navigator_.urls()[0],
2379 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url()); 2380 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url());
2380 EXPECT_EQ(navigator_.urls()[1], 2381 EXPECT_EQ(navigator_.urls()[1],
2381 model_->bookmark_bar_node()->GetChild(0)->GetChild(2)->url()); 2382 model_->bookmark_bar_node()->GetChild(0)->GetChild(2)->url());
2382 Done(); 2383 Done();
2383 } 2384 }
2384 }; 2385 };
2385 2386
2386 VIEW_TEST(BookmarkBarViewTest27, MiddleClickOnFolderOpensAllBookmarks); 2387 VIEW_TEST(BookmarkBarViewTest27, MiddleClickOnFolderOpensAllBookmarks);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698