Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: chrome/browser/ui/views/menu_model_adapter_test.cc

Issue 8212006: base::Bind: Cleanup in automation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mac build fix. Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/menu_item_view_test.cc ('k') | chrome/test/base/ui_test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
6 #include "chrome/browser/automation/ui_controls.h" 7 #include "chrome/browser/automation/ui_controls.h"
7 #include "chrome/test/base/view_event_test_base.h" 8 #include "chrome/test/base/view_event_test_base.h"
8 #include "ui/base/models/menu_model.h" 9 #include "ui/base/models/menu_model.h"
9 #include "views/controls/button/menu_button.h" 10 #include "views/controls/button/menu_button.h"
10 #include "views/controls/menu/menu_controller.h" 11 #include "views/controls/menu/menu_controller.h"
11 #include "views/controls/menu/menu_item_view.h" 12 #include "views/controls/menu/menu_item_view.h"
12 #include "views/controls/menu/menu_model_adapter.h" 13 #include "views/controls/menu/menu_model_adapter.h"
13 #include "views/controls/menu/menu_runner.h" 14 #include "views/controls/menu/menu_runner.h"
14 #include "views/controls/menu/submenu_view.h" 15 #include "views/controls/menu/submenu_view.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 80
80 // Converts views::Event::flags to a WindowOpenDisposition. 81 // Converts views::Event::flags to a WindowOpenDisposition.
81 virtual int GetDispositionForEvent(int event_flags) OVERRIDE { 82 virtual int GetDispositionForEvent(int event_flags) OVERRIDE {
82 return 0; 83 return 0;
83 } 84 }
84 85
85 private: 86 private:
86 DISALLOW_COPY_AND_ASSIGN(TestViewsDelegate); 87 DISALLOW_COPY_AND_ASSIGN(TestViewsDelegate);
87 }; 88 };
88 89
89 // Implement most of the ui::MenuModel pure virtuals for subclasses 90 // Implement most of the ui::MenuModel pure virtual methods for subclasses
90 // 91 //
91 // Exceptions: 92 // Exceptions:
92 // virtual int GetItemCount() const = 0; 93 // virtual int GetItemCount() const = 0;
93 // virtual ItemType GetTypeAt(int index) const = 0; 94 // virtual ItemType GetTypeAt(int index) const = 0;
94 // virtual int GetCommandIdAt(int index) const = 0; 95 // virtual int GetCommandIdAt(int index) const = 0;
95 // virtual string16 GetLabelAt(int index) const = 0; 96 // virtual string16 GetLabelAt(int index) const = 0;
96 class CommonMenuModel : public ui::MenuModel { 97 class CommonMenuModel : public ui::MenuModel {
97 public: 98 public:
98 CommonMenuModel() { 99 CommonMenuModel() {
99 } 100 }
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 views::SubmenuView* topmenu = menu_->GetSubmenu(); 345 views::SubmenuView* topmenu = menu_->GetSubmenu();
345 ASSERT_TRUE(topmenu); 346 ASSERT_TRUE(topmenu);
346 ASSERT_FALSE(topmenu->IsShowing()); 347 ASSERT_FALSE(topmenu->IsShowing());
347 ASSERT_FALSE(top_menu_model_.IsSubmenuShowing()); 348 ASSERT_FALSE(top_menu_model_.IsSubmenuShowing());
348 349
349 Done(); 350 Done();
350 } 351 }
351 352
352 private: 353 private:
353 // Generate a mouse click on the specified view and post a new task. 354 // Generate a mouse click on the specified view and post a new task.
354 virtual void Click(views::View* view, Task* next) { 355 virtual void Click(views::View* view, const base::Closure& next) {
355 ui_controls::MoveMouseToCenterAndPress( 356 ui_controls::MoveMouseToCenterAndPress(
356 view, 357 view,
357 ui_controls::LEFT, 358 ui_controls::LEFT,
358 ui_controls::DOWN | ui_controls::UP, 359 ui_controls::DOWN | ui_controls::UP,
359 next); 360 next);
360 } 361 }
361 362
362 views::ViewsDelegate* old_views_delegate_; 363 views::ViewsDelegate* old_views_delegate_;
363 TestViewsDelegate views_delegate_; 364 TestViewsDelegate views_delegate_;
364 365
365 views::MenuButton* button_; 366 views::MenuButton* button_;
366 TopMenuModel top_menu_model_; 367 TopMenuModel top_menu_model_;
367 views::MenuModelAdapter menu_model_adapter_; 368 views::MenuModelAdapter menu_model_adapter_;
368 views::MenuItemView* menu_; 369 views::MenuItemView* menu_;
369 scoped_ptr<views::MenuRunner> menu_runner_; 370 scoped_ptr<views::MenuRunner> menu_runner_;
370 }; 371 };
371 372
372 VIEW_TEST(MenuModelAdapterTest, RebuildMenu) 373 VIEW_TEST(MenuModelAdapterTest, RebuildMenu)
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/menu_item_view_test.cc ('k') | chrome/test/base/ui_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698