| 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 content::WebContents* web_contents = | 148 content::WebContents* web_contents = |
| 149 web_contents_factory.CreateWebContents(&profile); | 149 web_contents_factory.CreateWebContents(&profile); |
| 150 SessionTabHelper::CreateForWebContents(web_contents); | 150 SessionTabHelper::CreateForWebContents(web_contents); |
| 151 action_view_delegate.set_web_contents(web_contents); | 151 action_view_delegate.set_web_contents(web_contents); |
| 152 | 152 |
| 153 // Move the mouse off the not-yet-existent button. | 153 // Move the mouse off the not-yet-existent button. |
| 154 ui::test::EventGenerator generator(GetContext(), widget()->GetNativeWindow()); | 154 ui::test::EventGenerator generator(GetContext(), widget()->GetNativeWindow()); |
| 155 generator.MoveMouseTo(gfx::Point(300, 300)); | 155 generator.MoveMouseTo(gfx::Point(300, 300)); |
| 156 | 156 |
| 157 // Create a new toolbar action view. | 157 // Create a new toolbar action view. |
| 158 ToolbarActionView view(&controller, &profile, &action_view_delegate); | 158 ToolbarActionView view(&controller, &action_view_delegate); |
| 159 view.set_owned_by_client(); | 159 view.set_owned_by_client(); |
| 160 view.SetBoundsRect(gfx::Rect(0, 0, 200, 20)); | 160 view.SetBoundsRect(gfx::Rect(0, 0, 200, 20)); |
| 161 widget()->SetContentsView(&view); | 161 widget()->SetContentsView(&view); |
| 162 widget()->Show(); | 162 widget()->Show(); |
| 163 | 163 |
| 164 // Check that the tooltip and accessible state of the view match the | 164 // Check that the tooltip and accessible state of the view match the |
| 165 // controller's. | 165 // controller's. |
| 166 base::string16 tooltip_test; | 166 base::string16 tooltip_test; |
| 167 EXPECT_TRUE(view.GetTooltipText(gfx::Point(), &tooltip_test)); | 167 EXPECT_TRUE(view.GetTooltipText(gfx::Point(), &tooltip_test)); |
| 168 EXPECT_EQ(tooltip, tooltip_test); | 168 EXPECT_EQ(tooltip, tooltip_test); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |