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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc

Issue 10913237: Allow the Views Delegate to provide the native widget. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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
OLDNEW
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/bind.h" 5 #include "base/bind.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 19 matching lines...) Expand all
30 #include "grit/generated_resources.h" 30 #include "grit/generated_resources.h"
31 #include "ui/base/accessibility/accessibility_types.h" 31 #include "ui/base/accessibility/accessibility_types.h"
32 #include "ui/base/clipboard/clipboard.h" 32 #include "ui/base/clipboard/clipboard.h"
33 #include "ui/base/keycodes/keyboard_codes.h" 33 #include "ui/base/keycodes/keyboard_codes.h"
34 #include "ui/ui_controls/ui_controls.h" 34 #include "ui/ui_controls/ui_controls.h"
35 #include "ui/views/controls/button/menu_button.h" 35 #include "ui/views/controls/button/menu_button.h"
36 #include "ui/views/controls/button/text_button.h" 36 #include "ui/views/controls/button/text_button.h"
37 #include "ui/views/controls/menu/menu_controller.h" 37 #include "ui/views/controls/menu/menu_controller.h"
38 #include "ui/views/controls/menu/menu_item_view.h" 38 #include "ui/views/controls/menu/menu_item_view.h"
39 #include "ui/views/controls/menu/submenu_view.h" 39 #include "ui/views/controls/menu/submenu_view.h"
40 #include "ui/views/views_delegate.h" 40 #include "ui/views/test/test_views_delegate.h"
41 #include "ui/views/widget/widget.h" 41 #include "ui/views/widget/widget.h"
42 42
43 using content::BrowserThread; 43 using content::BrowserThread;
44 using content::OpenURLParams; 44 using content::OpenURLParams;
45 using content::PageNavigator; 45 using content::PageNavigator;
46 using content::WebContents; 46 using content::WebContents;
47 47
48 namespace { 48 namespace {
49 49
50 void MoveMouseAndPress(const gfx::Point& screen_pos, 50 void MoveMouseAndPress(const gfx::Point& screen_pos,
51 ui_controls::MouseButton button, 51 ui_controls::MouseButton button,
52 int state, 52 int state,
53 const base::Closure& closure) { 53 const base::Closure& closure) {
54 ui_controls::SendMouseMove(screen_pos.x(), screen_pos.y()); 54 ui_controls::SendMouseMove(screen_pos.x(), screen_pos.y());
55 ui_controls::SendMouseEventsNotifyWhenDone(button, state, closure); 55 ui_controls::SendMouseEventsNotifyWhenDone(button, state, closure);
56 } 56 }
57 57
58 class ViewsDelegateImpl : public views::ViewsDelegate {
59 public:
60 ViewsDelegateImpl() {}
61 virtual void SaveWindowPlacement(const views::Widget* window,
62 const std::string& window_name,
63 const gfx::Rect& bounds,
64 ui::WindowShowState show_state) OVERRIDE {}
65 virtual bool GetSavedWindowPlacement(
66 const std::string& window_name,
67 gfx::Rect* bounds,
68 ui::WindowShowState* show_state) const OVERRIDE {
69 return false;
70 }
71
72 virtual void NotifyAccessibilityEvent(
73 views::View* view, ui::AccessibilityTypes::Event event_type) OVERRIDE {}
74 virtual void NotifyMenuItemFocused(const string16& menu_name,
75 const string16& menu_item_name,
76 int item_index,
77 int item_count,
78 bool has_submenu) OVERRIDE {}
79
80 #if defined(OS_WIN)
81 virtual HICON GetDefaultWindowIcon() const OVERRIDE { return 0; }
82 #endif
83 virtual views::NonClientFrameView* CreateDefaultNonClientFrameView(
84 views::Widget* widget) OVERRIDE {
85 return NULL;
86 }
87
88 virtual bool UseTransparentWindows() const OVERRIDE {
89 return false;
90 }
91
92 virtual void AddRef() OVERRIDE {
93 }
94
95 virtual void ReleaseRef() OVERRIDE {
96 MessageLoopForUI::current()->Quit();
97 }
98
99 virtual int GetDispositionForEvent(int event_flags) OVERRIDE {
100 return 0;
101 }
102
103 #if defined(USE_AURA)
104 virtual views::NativeWidgetHelperAura* CreateNativeWidgetHelper(
105 views::NativeWidgetAura* native_widget) OVERRIDE {
106 return NULL;
107 }
108 #endif
109
110 virtual content::WebContents* CreateWebContents(
111 content::BrowserContext* browser_context,
112 content::SiteInstance* site_instance) OVERRIDE {
113 return NULL;
114 }
115
116 private:
117 DISALLOW_COPY_AND_ASSIGN(ViewsDelegateImpl);
118 };
119
120 // PageNavigator implementation that records the URL. 58 // PageNavigator implementation that records the URL.
121 class TestingPageNavigator : public PageNavigator { 59 class TestingPageNavigator : public PageNavigator {
122 public: 60 public:
123 virtual WebContents* OpenURL(const OpenURLParams& params) OVERRIDE { 61 virtual WebContents* OpenURL(const OpenURLParams& params) OVERRIDE {
124 url_ = params.url; 62 url_ = params.url;
125 return NULL; 63 return NULL;
126 } 64 }
127 65
128 GURL url_; 66 GURL url_;
129 }; 67 };
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 const BookmarkNode* of2 = model_->AddFolder(model_->other_node(), 2, 220 const BookmarkNode* of2 = model_->AddFolder(model_->other_node(), 2,
283 ASCIIToUTF16("OF2")); 221 ASCIIToUTF16("OF2"));
284 model_->AddURL(of2, 0, ASCIIToUTF16("of2a"), GURL(test_base + "of2a")); 222 model_->AddURL(of2, 0, ASCIIToUTF16("of2a"), GURL(test_base + "of2a"));
285 model_->AddURL(of2, 1, ASCIIToUTF16("of2b"), GURL(test_base + "of2b")); 223 model_->AddURL(of2, 1, ASCIIToUTF16("of2b"), GURL(test_base + "of2b"));
286 } 224 }
287 225
288 gfx::Size bb_view_pref_; 226 gfx::Size bb_view_pref_;
289 scoped_ptr<TestingProfile> profile_; 227 scoped_ptr<TestingProfile> profile_;
290 scoped_ptr<Browser> browser_; 228 scoped_ptr<Browser> browser_;
291 content::TestBrowserThread file_thread_; 229 content::TestBrowserThread file_thread_;
292 ViewsDelegateImpl views_delegate_; 230 views::TestViewsDelegate views_delegate_;
293 }; 231 };
294 232
295 // Clicks on first menu, makes sure button is depressed. Moves mouse to first 233 // Clicks on first menu, makes sure button is depressed. Moves mouse to first
296 // child, clicks it and makes sure a navigation occurs. 234 // child, clicks it and makes sure a navigation occurs.
297 class BookmarkBarViewTest1 : public BookmarkBarViewEventTestBase { 235 class BookmarkBarViewTest1 : public BookmarkBarViewEventTestBase {
298 protected: 236 protected:
299 virtual void DoTestOnMessageLoop() { 237 virtual void DoTestOnMessageLoop() {
300 // Move the mouse to the first folder on the bookmark bar and press the 238 // Move the mouse to the first folder on the bookmark bar and press the
301 // mouse. 239 // mouse.
302 views::TextButton* button = GetBookmarkButton(0); 240 views::TextButton* button = GetBookmarkButton(0);
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 Done(); 1650 Done();
1713 } 1651 }
1714 }; 1652 };
1715 1653
1716 #if defined(OS_WIN) 1654 #if defined(OS_WIN)
1717 #define MAYBE_BookmarkBarViewTest19_SiblingMenu DISABLED_SiblingMenu 1655 #define MAYBE_BookmarkBarViewTest19_SiblingMenu DISABLED_SiblingMenu
1718 #else 1656 #else
1719 #define MAYBE_BookmarkBarViewTest19_SiblingMenu SiblingMenu 1657 #define MAYBE_BookmarkBarViewTest19_SiblingMenu SiblingMenu
1720 #endif 1658 #endif
1721 VIEW_TEST(BookmarkBarViewTest19, MAYBE_BookmarkBarViewTest19_SiblingMenu) 1659 VIEW_TEST(BookmarkBarViewTest19, MAYBE_BookmarkBarViewTest19_SiblingMenu)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698