| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/callback.h" | 5 #include "base/callback.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "chrome/test/base/interactive_test_utils.h" | 7 #include "chrome/test/base/interactive_test_utils.h" |
| 8 #include "chrome/test/base/ui_test_utils.h" | 8 #include "chrome/test/base/ui_test_utils.h" |
| 9 #include "chrome/test/base/view_event_test_base.h" | 9 #include "chrome/test/base/view_event_test_base.h" |
| 10 #include "ui/base/models/menu_model.h" | 10 #include "ui/base/models/menu_model.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 virtual void TearDown() OVERRIDE { | 214 virtual void TearDown() OVERRIDE { |
| 215 menu_runner_.reset(NULL); | 215 menu_runner_.reset(NULL); |
| 216 menu_ = NULL; | 216 menu_ = NULL; |
| 217 ViewEventTestBase::TearDown(); | 217 ViewEventTestBase::TearDown(); |
| 218 } | 218 } |
| 219 | 219 |
| 220 virtual views::View* CreateContentsView() OVERRIDE { | 220 virtual views::View* CreateContentsView() OVERRIDE { |
| 221 return button_; | 221 return button_; |
| 222 } | 222 } |
| 223 | 223 |
| 224 virtual gfx::Size GetPreferredSize() OVERRIDE { | 224 virtual gfx::Size GetPreferredSize() const OVERRIDE { |
| 225 return button_->GetPreferredSize(); | 225 return button_->GetPreferredSize(); |
| 226 } | 226 } |
| 227 | 227 |
| 228 // views::MenuButtonListener implementation. | 228 // views::MenuButtonListener implementation. |
| 229 virtual void OnMenuButtonClicked(views::View* source, | 229 virtual void OnMenuButtonClicked(views::View* source, |
| 230 const gfx::Point& point) OVERRIDE { | 230 const gfx::Point& point) OVERRIDE { |
| 231 gfx::Point screen_location; | 231 gfx::Point screen_location; |
| 232 views::View::ConvertPointToScreen(source, &screen_location); | 232 views::View::ConvertPointToScreen(source, &screen_location); |
| 233 gfx::Rect bounds(screen_location, source->size()); | 233 gfx::Rect bounds(screen_location, source->size()); |
| 234 ignore_result(menu_runner_->RunMenuAt(source->GetWidget(), | 234 ignore_result(menu_runner_->RunMenuAt(source->GetWidget(), |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 } | 303 } |
| 304 | 304 |
| 305 views::MenuButton* button_; | 305 views::MenuButton* button_; |
| 306 TopMenuModel top_menu_model_; | 306 TopMenuModel top_menu_model_; |
| 307 views::MenuModelAdapter menu_model_adapter_; | 307 views::MenuModelAdapter menu_model_adapter_; |
| 308 views::MenuItemView* menu_; | 308 views::MenuItemView* menu_; |
| 309 scoped_ptr<views::MenuRunner> menu_runner_; | 309 scoped_ptr<views::MenuRunner> menu_runner_; |
| 310 }; | 310 }; |
| 311 | 311 |
| 312 VIEW_TEST(MenuModelAdapterTest, RebuildMenu) | 312 VIEW_TEST(MenuModelAdapterTest, RebuildMenu) |
| OLD | NEW |