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

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_action_view_unittest.cc

Issue 1682603002: [UI Views] Don't allow a ButtonListener and a MenuButtonListener (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 4 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/macros.h" 5 #include "base/macros.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "base/strings/string16.h" 7 #include "base/strings/string16.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/sessions/session_tab_helper.h" 9 #include "chrome/browser/sessions/session_tab_helper.h"
10 #include "chrome/browser/ui/toolbar/test_toolbar_action_view_controller.h" 10 #include "chrome/browser/ui/toolbar/test_toolbar_action_view_controller.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 EXPECT_EQ(old_execute_action_count, controller.execute_action_count()); 211 EXPECT_EQ(old_execute_action_count, controller.execute_action_count());
212 } 212 }
213 213
214 // Ensure that the button's want-to-run state reflects that of the controller. 214 // Ensure that the button's want-to-run state reflects that of the controller.
215 controller.SetWantsToRun(true); 215 controller.SetWantsToRun(true);
216 EXPECT_TRUE(view.wants_to_run_for_testing()); 216 EXPECT_TRUE(view.wants_to_run_for_testing());
217 controller.SetWantsToRun(false); 217 controller.SetWantsToRun(false);
218 EXPECT_FALSE(view.wants_to_run_for_testing()); 218 EXPECT_FALSE(view.wants_to_run_for_testing());
219 219
220 // Create an overflow button. 220 // Create an overflow button.
221 views::MenuButton overflow_button(nullptr, base::string16(), nullptr, false); 221 views::MenuButton overflow_button(base::string16(), nullptr, false);
222 overflow_button.set_owned_by_client(); 222 overflow_button.set_owned_by_client();
223 action_view_delegate.set_overflow_reference_view(&overflow_button); 223 action_view_delegate.set_overflow_reference_view(&overflow_button);
224 224
225 // If the view isn't visible, the overflow button should be pressed for 225 // If the view isn't visible, the overflow button should be pressed for
226 // popups. 226 // popups.
227 view.SetVisible(false); 227 view.SetVisible(false);
228 controller.ShowPopup(true); 228 controller.ShowPopup(true);
229 EXPECT_EQ(views::Button::STATE_NORMAL, view.state()); 229 EXPECT_EQ(views::Button::STATE_NORMAL, view.state());
230 EXPECT_EQ(views::Button::STATE_PRESSED, overflow_button.state()); 230 EXPECT_EQ(views::Button::STATE_PRESSED, overflow_button.state());
231 controller.HidePopup(); 231 controller.HidePopup();
232 EXPECT_EQ(views::Button::STATE_NORMAL, view.state()); 232 EXPECT_EQ(views::Button::STATE_NORMAL, view.state());
233 EXPECT_EQ(views::Button::STATE_NORMAL, overflow_button.state()); 233 EXPECT_EQ(views::Button::STATE_NORMAL, overflow_button.state());
234 } 234 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698