| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |