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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 }; | 148 }; |
149 | 149 |
150 // Verifies there is no crash when a ToolbarActionView with an InkDropDelegate | 150 // Verifies there is no crash when a ToolbarActionView with an InkDropDelegate |
151 // is destroyed while holding a |pressed_lock_|. | 151 // is destroyed while holding a |pressed_lock_|. |
152 TEST_F(ToolbarActionViewUnitTest, | 152 TEST_F(ToolbarActionViewUnitTest, |
153 NoCrashWhenDestroyingToolbarActionViewThatHasAPressedLock) { | 153 NoCrashWhenDestroyingToolbarActionViewThatHasAPressedLock) { |
154 TestToolbarActionViewController controller("fake controller"); | 154 TestToolbarActionViewController controller("fake controller"); |
155 TestToolbarActionViewDelegate action_view_delegate; | 155 TestToolbarActionViewDelegate action_view_delegate; |
156 | 156 |
157 // Create a new toolbar action view. | 157 // Create a new toolbar action view. |
158 scoped_ptr<ToolbarActionView> view( | 158 std::unique_ptr<ToolbarActionView> view( |
159 new ToolbarActionView(&controller, &action_view_delegate)); | 159 new ToolbarActionView(&controller, &action_view_delegate)); |
160 view->set_owned_by_client(); | 160 view->set_owned_by_client(); |
161 view->SetBoundsRect(gfx::Rect(0, 0, 200, 20)); | 161 view->SetBoundsRect(gfx::Rect(0, 0, 200, 20)); |
162 widget()->SetContentsView(view.get()); | 162 widget()->SetContentsView(view.get()); |
163 widget()->Show(); | 163 widget()->Show(); |
164 | 164 |
165 controller.ShowPopup(true); | 165 controller.ShowPopup(true); |
166 | 166 |
167 view.reset(); | 167 view.reset(); |
168 } | 168 } |
(...skipping 114 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 | 283 // If the view isn't visible, the overflow button should be pressed for |
284 // popups. | 284 // popups. |
285 view.SetVisible(false); | 285 view.SetVisible(false); |
286 controller.ShowPopup(true); | 286 controller.ShowPopup(true); |
287 EXPECT_EQ(views::Button::STATE_NORMAL, view.state()); | 287 EXPECT_EQ(views::Button::STATE_NORMAL, view.state()); |
288 EXPECT_EQ(views::Button::STATE_PRESSED, overflow_button.state()); | 288 EXPECT_EQ(views::Button::STATE_PRESSED, overflow_button.state()); |
289 controller.HidePopup(); | 289 controller.HidePopup(); |
290 EXPECT_EQ(views::Button::STATE_NORMAL, view.state()); | 290 EXPECT_EQ(views::Button::STATE_NORMAL, view.state()); |
291 EXPECT_EQ(views::Button::STATE_NORMAL, overflow_button.state()); | 291 EXPECT_EQ(views::Button::STATE_NORMAL, overflow_button.state()); |
292 } | 292 } |
OLD | NEW |