| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 131 |
| 132 // A MenuButton subclass that provides access to some MenuButton internals. | 132 // A MenuButton subclass that provides access to some MenuButton internals. |
| 133 class TestToolbarActionView : public ToolbarActionView { | 133 class TestToolbarActionView : public ToolbarActionView { |
| 134 public: | 134 public: |
| 135 TestToolbarActionView(ToolbarActionViewController* view_controller, | 135 TestToolbarActionView(ToolbarActionViewController* view_controller, |
| 136 Delegate* delegate) | 136 Delegate* delegate) |
| 137 : ToolbarActionView(view_controller, delegate) {} | 137 : ToolbarActionView(view_controller, delegate) {} |
| 138 | 138 |
| 139 ~TestToolbarActionView() override {} | 139 ~TestToolbarActionView() override {} |
| 140 | 140 |
| 141 // Accessors to protected ToolbarActionView methods. | |
| 142 void set_ink_drop_delegate(views::InkDropDelegate* ink_drop_delegate) { | |
| 143 ToolbarActionView::set_ink_drop_delegate(ink_drop_delegate); | |
| 144 } | |
| 145 | |
| 146 private: | 141 private: |
| 147 DISALLOW_COPY_AND_ASSIGN(TestToolbarActionView); | 142 DISALLOW_COPY_AND_ASSIGN(TestToolbarActionView); |
| 148 }; | 143 }; |
| 149 | 144 |
| 150 // Verifies there is no crash when a ToolbarActionView with an InkDropDelegate | 145 // Verifies there is no crash when a ToolbarActionView with an InkDropDelegate |
| 151 // is destroyed while holding a |pressed_lock_|. | 146 // is destroyed while holding a |pressed_lock_|. |
| 152 TEST_F(ToolbarActionViewUnitTest, | 147 TEST_F(ToolbarActionViewUnitTest, |
| 153 NoCrashWhenDestroyingToolbarActionViewThatHasAPressedLock) { | 148 NoCrashWhenDestroyingToolbarActionViewThatHasAPressedLock) { |
| 154 TestToolbarActionViewController controller("fake controller"); | 149 TestToolbarActionViewController controller("fake controller"); |
| 155 TestToolbarActionViewDelegate action_view_delegate; | 150 TestToolbarActionViewDelegate action_view_delegate; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 // If the view isn't visible, the overflow button should be pressed for | 278 // If the view isn't visible, the overflow button should be pressed for |
| 284 // popups. | 279 // popups. |
| 285 view.SetVisible(false); | 280 view.SetVisible(false); |
| 286 controller.ShowPopup(true); | 281 controller.ShowPopup(true); |
| 287 EXPECT_EQ(views::Button::STATE_NORMAL, view.state()); | 282 EXPECT_EQ(views::Button::STATE_NORMAL, view.state()); |
| 288 EXPECT_EQ(views::Button::STATE_PRESSED, overflow_button.state()); | 283 EXPECT_EQ(views::Button::STATE_PRESSED, overflow_button.state()); |
| 289 controller.HidePopup(); | 284 controller.HidePopup(); |
| 290 EXPECT_EQ(views::Button::STATE_NORMAL, view.state()); | 285 EXPECT_EQ(views::Button::STATE_NORMAL, view.state()); |
| 291 EXPECT_EQ(views::Button::STATE_NORMAL, overflow_button.state()); | 286 EXPECT_EQ(views::Button::STATE_NORMAL, overflow_button.state()); |
| 292 } | 287 } |
| OLD | NEW |