| 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/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/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); | 73 base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); |
| 74 base::MessageLoopForUI::ScopedNestableTaskAllower allow_nested(loop); | 74 base::MessageLoopForUI::ScopedNestableTaskAllower allow_nested(loop); |
| 75 base::RunLoop run_loop; | 75 base::RunLoop run_loop; |
| 76 quit_closure_ = run_loop.QuitClosure(); | 76 quit_closure_ = run_loop.QuitClosure(); |
| 77 run_loop.Run(); | 77 run_loop.Run(); |
| 78 return dialog_; | 78 return dialog_; |
| 79 } | 79 } |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 // aura::EnvObserver: | 82 // aura::EnvObserver: |
| 83 virtual void OnWindowInitialized(aura::Window* window) OVERRIDE { | 83 virtual void OnWindowInitialized(aura::Window* window) override { |
| 84 if (dialog_) | 84 if (dialog_) |
| 85 return; | 85 return; |
| 86 views::Widget* widget = views::Widget::GetWidgetForNativeView(window); | 86 views::Widget* widget = views::Widget::GetWidgetForNativeView(window); |
| 87 if (!widget || !widget->IsDialogBox()) | 87 if (!widget || !widget->IsDialogBox()) |
| 88 return; | 88 return; |
| 89 dialog_ = widget; | 89 dialog_ = widget; |
| 90 dialog_->AddObserver(this); | 90 dialog_->AddObserver(this); |
| 91 } | 91 } |
| 92 | 92 |
| 93 // views::WidgetObserver: | 93 // views::WidgetObserver: |
| 94 virtual void OnWidgetVisibilityChanged(views::Widget* widget, | 94 virtual void OnWidgetVisibilityChanged(views::Widget* widget, |
| 95 bool visible) OVERRIDE { | 95 bool visible) override { |
| 96 CHECK_EQ(dialog_, widget); | 96 CHECK_EQ(dialog_, widget); |
| 97 if (visible) { | 97 if (visible) { |
| 98 dialog_created_ = true; | 98 dialog_created_ = true; |
| 99 dialog_->RemoveObserver(this); | 99 dialog_->RemoveObserver(this); |
| 100 if (!quit_closure_.is_null()) | 100 if (!quit_closure_.is_null()) |
| 101 quit_closure_.Run(); | 101 quit_closure_.Run(); |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 bool dialog_created_; | 105 bool dialog_created_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 127 return; | 127 return; |
| 128 base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); | 128 base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); |
| 129 base::MessageLoopForUI::ScopedNestableTaskAllower allow_nested(loop); | 129 base::MessageLoopForUI::ScopedNestableTaskAllower allow_nested(loop); |
| 130 base::RunLoop run_loop; | 130 base::RunLoop run_loop; |
| 131 quit_closure_ = run_loop.QuitClosure(); | 131 quit_closure_ = run_loop.QuitClosure(); |
| 132 run_loop.Run(); | 132 run_loop.Run(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 private: | 135 private: |
| 136 // views::WidgetObserver: | 136 // views::WidgetObserver: |
| 137 virtual void OnWidgetDestroyed(views::Widget* widget) OVERRIDE { | 137 virtual void OnWidgetDestroyed(views::Widget* widget) override { |
| 138 dialog_closed_ = true; | 138 dialog_closed_ = true; |
| 139 if (!quit_closure_.is_null()) | 139 if (!quit_closure_.is_null()) |
| 140 quit_closure_.Run(); | 140 quit_closure_.Run(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 bool dialog_closed_; | 143 bool dialog_closed_; |
| 144 base::Closure quit_closure_; | 144 base::Closure quit_closure_; |
| 145 | 145 |
| 146 DISALLOW_COPY_AND_ASSIGN(DialogCloseWaiter); | 146 DISALLOW_COPY_AND_ASSIGN(DialogCloseWaiter); |
| 147 }; | 147 }; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 164 return; | 164 return; |
| 165 base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); | 165 base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); |
| 166 base::MessageLoopForUI::ScopedNestableTaskAllower allow_nested(loop); | 166 base::MessageLoopForUI::ScopedNestableTaskAllower allow_nested(loop); |
| 167 base::RunLoop run_loop; | 167 base::RunLoop run_loop; |
| 168 quit_closure_ = run_loop.QuitClosure(); | 168 quit_closure_ = run_loop.QuitClosure(); |
| 169 run_loop.Run(); | 169 run_loop.Run(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 private: | 172 private: |
| 173 // ui::EventHandler: | 173 // ui::EventHandler: |
| 174 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE { | 174 virtual void OnKeyEvent(ui::KeyEvent* event) override { |
| 175 if (event->type() == ui::ET_KEY_RELEASED && | 175 if (event->type() == ui::ET_KEY_RELEASED && |
| 176 event->key_code() == ui::VKEY_TAB) { | 176 event->key_code() == ui::VKEY_TAB) { |
| 177 received_tab_ = true; | 177 received_tab_ = true; |
| 178 if (!quit_closure_.is_null()) | 178 if (!quit_closure_.is_null()) |
| 179 quit_closure_.Run(); | 179 quit_closure_.Run(); |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 | 182 |
| 183 views::Widget* widget_; | 183 views::Widget* widget_; |
| 184 bool received_tab_; | 184 bool received_tab_; |
| 185 base::Closure quit_closure_; | 185 base::Closure quit_closure_; |
| 186 | 186 |
| 187 DISALLOW_COPY_AND_ASSIGN(TabKeyWaiter); | 187 DISALLOW_COPY_AND_ASSIGN(TabKeyWaiter); |
| 188 }; | 188 }; |
| 189 | 189 |
| 190 void MoveMouseAndPress(const gfx::Point& screen_pos, | 190 void MoveMouseAndPress(const gfx::Point& screen_pos, |
| 191 ui_controls::MouseButton button, | 191 ui_controls::MouseButton button, |
| 192 int state, | 192 int state, |
| 193 const base::Closure& closure) { | 193 const base::Closure& closure) { |
| 194 ui_controls::SendMouseMove(screen_pos.x(), screen_pos.y()); | 194 ui_controls::SendMouseMove(screen_pos.x(), screen_pos.y()); |
| 195 ui_controls::SendMouseEventsNotifyWhenDone(button, state, closure); | 195 ui_controls::SendMouseEventsNotifyWhenDone(button, state, closure); |
| 196 } | 196 } |
| 197 | 197 |
| 198 // PageNavigator implementation that records the URL. | 198 // PageNavigator implementation that records the URL. |
| 199 class TestingPageNavigator : public PageNavigator { | 199 class TestingPageNavigator : public PageNavigator { |
| 200 public: | 200 public: |
| 201 virtual WebContents* OpenURL(const OpenURLParams& params) OVERRIDE { | 201 virtual WebContents* OpenURL(const OpenURLParams& params) override { |
| 202 url_ = params.url; | 202 url_ = params.url; |
| 203 return NULL; | 203 return NULL; |
| 204 } | 204 } |
| 205 | 205 |
| 206 GURL url_; | 206 GURL url_; |
| 207 }; | 207 }; |
| 208 | 208 |
| 209 // TODO(erg): Fix bookmark DND tests on linux_aura. crbug.com/163931 | 209 // TODO(erg): Fix bookmark DND tests on linux_aura. crbug.com/163931 |
| 210 #if defined(OS_LINUX) && defined(USE_AURA) | 210 #if defined(OS_LINUX) && defined(USE_AURA) |
| 211 #define MAYBE(x) DISABLED_##x | 211 #define MAYBE(x) DISABLED_##x |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 // the names f1-f100. | 245 // the names f1-f100. |
| 246 // | 246 // |
| 247 // Subclasses should be sure and invoke super's implementation of SetUp and | 247 // Subclasses should be sure and invoke super's implementation of SetUp and |
| 248 // TearDown. | 248 // TearDown. |
| 249 class BookmarkBarViewEventTestBase : public ViewEventTestBase { | 249 class BookmarkBarViewEventTestBase : public ViewEventTestBase { |
| 250 public: | 250 public: |
| 251 BookmarkBarViewEventTestBase() | 251 BookmarkBarViewEventTestBase() |
| 252 : ViewEventTestBase(), | 252 : ViewEventTestBase(), |
| 253 model_(NULL) {} | 253 model_(NULL) {} |
| 254 | 254 |
| 255 virtual void SetUp() OVERRIDE { | 255 virtual void SetUp() override { |
| 256 content_client_.reset(new ChromeContentClient); | 256 content_client_.reset(new ChromeContentClient); |
| 257 content::SetContentClient(content_client_.get()); | 257 content::SetContentClient(content_client_.get()); |
| 258 browser_content_client_.reset(new chrome::ChromeContentBrowserClient()); | 258 browser_content_client_.reset(new chrome::ChromeContentBrowserClient()); |
| 259 content::SetBrowserClientForTesting(browser_content_client_.get()); | 259 content::SetBrowserClientForTesting(browser_content_client_.get()); |
| 260 | 260 |
| 261 views::MenuController::TurnOffMenuSelectionHoldForTest(); | 261 views::MenuController::TurnOffMenuSelectionHoldForTest(); |
| 262 BookmarkBarView::DisableAnimationsForTesting(true); | 262 BookmarkBarView::DisableAnimationsForTesting(true); |
| 263 | 263 |
| 264 profile_.reset(new TestingProfile()); | 264 profile_.reset(new TestingProfile()); |
| 265 profile_->CreateBookmarkModel(true); | 265 profile_->CreateBookmarkModel(true); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 | 327 |
| 328 ViewEventTestBase::TearDown(); | 328 ViewEventTestBase::TearDown(); |
| 329 BookmarkBarView::DisableAnimationsForTesting(false); | 329 BookmarkBarView::DisableAnimationsForTesting(false); |
| 330 | 330 |
| 331 browser_content_client_.reset(); | 331 browser_content_client_.reset(); |
| 332 content_client_.reset(); | 332 content_client_.reset(); |
| 333 content::SetContentClient(NULL); | 333 content::SetContentClient(NULL); |
| 334 } | 334 } |
| 335 | 335 |
| 336 protected: | 336 protected: |
| 337 virtual views::View* CreateContentsView() OVERRIDE { | 337 virtual views::View* CreateContentsView() override { |
| 338 return bb_view_.get(); | 338 return bb_view_.get(); |
| 339 } | 339 } |
| 340 | 340 |
| 341 virtual gfx::Size GetPreferredSize() const OVERRIDE { return bb_view_pref_; } | 341 virtual gfx::Size GetPreferredSize() const override { return bb_view_pref_; } |
| 342 | 342 |
| 343 views::LabelButton* GetBookmarkButton(int view_index) { | 343 views::LabelButton* GetBookmarkButton(int view_index) { |
| 344 return bb_view_->GetBookmarkButton(view_index); | 344 return bb_view_->GetBookmarkButton(view_index); |
| 345 } | 345 } |
| 346 | 346 |
| 347 // See comment above class description for what this does. | 347 // See comment above class description for what this does. |
| 348 virtual bool CreateBigMenu() { return false; } | 348 virtual bool CreateBigMenu() { return false; } |
| 349 | 349 |
| 350 BookmarkModel* model_; | 350 BookmarkModel* model_; |
| 351 scoped_ptr<BookmarkBarView> bb_view_; | 351 scoped_ptr<BookmarkBarView> bb_view_; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 scoped_ptr<chrome::ChromeContentBrowserClient> browser_content_client_; | 389 scoped_ptr<chrome::ChromeContentBrowserClient> browser_content_client_; |
| 390 scoped_ptr<TestingProfile> profile_; | 390 scoped_ptr<TestingProfile> profile_; |
| 391 scoped_ptr<Browser> browser_; | 391 scoped_ptr<Browser> browser_; |
| 392 scoped_ptr<ScopedTestingLocalState> local_state_; | 392 scoped_ptr<ScopedTestingLocalState> local_state_; |
| 393 }; | 393 }; |
| 394 | 394 |
| 395 // Clicks on first menu, makes sure button is depressed. Moves mouse to first | 395 // Clicks on first menu, makes sure button is depressed. Moves mouse to first |
| 396 // child, clicks it and makes sure a navigation occurs. | 396 // child, clicks it and makes sure a navigation occurs. |
| 397 class BookmarkBarViewTest1 : public BookmarkBarViewEventTestBase { | 397 class BookmarkBarViewTest1 : public BookmarkBarViewEventTestBase { |
| 398 protected: | 398 protected: |
| 399 virtual void DoTestOnMessageLoop() OVERRIDE { | 399 virtual void DoTestOnMessageLoop() override { |
| 400 // Move the mouse to the first folder on the bookmark bar and press the | 400 // Move the mouse to the first folder on the bookmark bar and press the |
| 401 // mouse. | 401 // mouse. |
| 402 views::LabelButton* button = GetBookmarkButton(0); | 402 views::LabelButton* button = GetBookmarkButton(0); |
| 403 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 403 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
| 404 ui_controls::DOWN | ui_controls::UP, | 404 ui_controls::DOWN | ui_controls::UP, |
| 405 CreateEventTask(this, &BookmarkBarViewTest1::Step2)); | 405 CreateEventTask(this, &BookmarkBarViewTest1::Step2)); |
| 406 } | 406 } |
| 407 | 407 |
| 408 private: | 408 private: |
| 409 void Step2() { | 409 void Step2() { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 440 | 440 |
| 441 Done(); | 441 Done(); |
| 442 } | 442 } |
| 443 }; | 443 }; |
| 444 | 444 |
| 445 VIEW_TEST(BookmarkBarViewTest1, Basic) | 445 VIEW_TEST(BookmarkBarViewTest1, Basic) |
| 446 | 446 |
| 447 // Brings up menu, clicks on empty space and make sure menu hides. | 447 // Brings up menu, clicks on empty space and make sure menu hides. |
| 448 class BookmarkBarViewTest2 : public BookmarkBarViewEventTestBase { | 448 class BookmarkBarViewTest2 : public BookmarkBarViewEventTestBase { |
| 449 protected: | 449 protected: |
| 450 virtual void DoTestOnMessageLoop() OVERRIDE { | 450 virtual void DoTestOnMessageLoop() override { |
| 451 // Move the mouse to the first folder on the bookmark bar and press the | 451 // Move the mouse to the first folder on the bookmark bar and press the |
| 452 // mouse. | 452 // mouse. |
| 453 views::LabelButton* button = GetBookmarkButton(0); | 453 views::LabelButton* button = GetBookmarkButton(0); |
| 454 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 454 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
| 455 ui_controls::DOWN | ui_controls::UP, | 455 ui_controls::DOWN | ui_controls::UP, |
| 456 CreateEventTask(this, &BookmarkBarViewTest2::Step2)); | 456 CreateEventTask(this, &BookmarkBarViewTest2::Step2)); |
| 457 } | 457 } |
| 458 | 458 |
| 459 private: | 459 private: |
| 460 void Step2() { | 460 void Step2() { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 #else | 501 #else |
| 502 #define MAYBE_HideOnDesktopClick HideOnDesktopClick | 502 #define MAYBE_HideOnDesktopClick HideOnDesktopClick |
| 503 #endif | 503 #endif |
| 504 | 504 |
| 505 VIEW_TEST(BookmarkBarViewTest2, MAYBE_HideOnDesktopClick) | 505 VIEW_TEST(BookmarkBarViewTest2, MAYBE_HideOnDesktopClick) |
| 506 | 506 |
| 507 // Brings up menu. Moves over child to make sure submenu appears, moves over | 507 // Brings up menu. Moves over child to make sure submenu appears, moves over |
| 508 // another child and make sure next menu appears. | 508 // another child and make sure next menu appears. |
| 509 class BookmarkBarViewTest3 : public BookmarkBarViewEventTestBase { | 509 class BookmarkBarViewTest3 : public BookmarkBarViewEventTestBase { |
| 510 protected: | 510 protected: |
| 511 virtual void DoTestOnMessageLoop() OVERRIDE { | 511 virtual void DoTestOnMessageLoop() override { |
| 512 // Move the mouse to the first folder on the bookmark bar and press the | 512 // Move the mouse to the first folder on the bookmark bar and press the |
| 513 // mouse. | 513 // mouse. |
| 514 views::MenuButton* button = bb_view_->other_bookmarked_button(); | 514 views::MenuButton* button = bb_view_->other_bookmarked_button(); |
| 515 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 515 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
| 516 ui_controls::DOWN | ui_controls::UP, | 516 ui_controls::DOWN | ui_controls::UP, |
| 517 CreateEventTask(this, &BookmarkBarViewTest3::Step2)); | 517 CreateEventTask(this, &BookmarkBarViewTest3::Step2)); |
| 518 } | 518 } |
| 519 | 519 |
| 520 private: | 520 private: |
| 521 void Step2() { | 521 void Step2() { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 public: | 584 public: |
| 585 explicit BookmarkContextMenuNotificationObserver(const base::Closure& task) | 585 explicit BookmarkContextMenuNotificationObserver(const base::Closure& task) |
| 586 : task_(task) { | 586 : task_(task) { |
| 587 registrar_.Add(this, | 587 registrar_.Add(this, |
| 588 chrome::NOTIFICATION_BOOKMARK_CONTEXT_MENU_SHOWN, | 588 chrome::NOTIFICATION_BOOKMARK_CONTEXT_MENU_SHOWN, |
| 589 content::NotificationService::AllSources()); | 589 content::NotificationService::AllSources()); |
| 590 } | 590 } |
| 591 | 591 |
| 592 virtual void Observe(int type, | 592 virtual void Observe(int type, |
| 593 const content::NotificationSource& source, | 593 const content::NotificationSource& source, |
| 594 const content::NotificationDetails& details) OVERRIDE { | 594 const content::NotificationDetails& details) override { |
| 595 base::MessageLoop::current()->PostTask(FROM_HERE, task_); | 595 base::MessageLoop::current()->PostTask(FROM_HERE, task_); |
| 596 } | 596 } |
| 597 | 597 |
| 598 // Sets the task that is posted when the context menu is shown. | 598 // Sets the task that is posted when the context menu is shown. |
| 599 void set_task(const base::Closure& task) { task_ = task; } | 599 void set_task(const base::Closure& task) { task_ = task; } |
| 600 | 600 |
| 601 private: | 601 private: |
| 602 content::NotificationRegistrar registrar_; | 602 content::NotificationRegistrar registrar_; |
| 603 base::Closure task_; | 603 base::Closure task_; |
| 604 | 604 |
| 605 DISALLOW_COPY_AND_ASSIGN(BookmarkContextMenuNotificationObserver); | 605 DISALLOW_COPY_AND_ASSIGN(BookmarkContextMenuNotificationObserver); |
| 606 }; | 606 }; |
| 607 | 607 |
| 608 // Tests context menus by way of opening a context menu for a bookmark, | 608 // Tests context menus by way of opening a context menu for a bookmark, |
| 609 // then right clicking to get context menu and selecting the first menu item | 609 // then right clicking to get context menu and selecting the first menu item |
| 610 // (open). | 610 // (open). |
| 611 class BookmarkBarViewTest4 : public BookmarkBarViewEventTestBase { | 611 class BookmarkBarViewTest4 : public BookmarkBarViewEventTestBase { |
| 612 public: | 612 public: |
| 613 BookmarkBarViewTest4() | 613 BookmarkBarViewTest4() |
| 614 : observer_(CreateEventTask(this, &BookmarkBarViewTest4::Step3)) { | 614 : observer_(CreateEventTask(this, &BookmarkBarViewTest4::Step3)) { |
| 615 } | 615 } |
| 616 | 616 |
| 617 protected: | 617 protected: |
| 618 virtual void DoTestOnMessageLoop() OVERRIDE { | 618 virtual void DoTestOnMessageLoop() override { |
| 619 // Move the mouse to the first folder on the bookmark bar and press the | 619 // Move the mouse to the first folder on the bookmark bar and press the |
| 620 // mouse. | 620 // mouse. |
| 621 views::LabelButton* button = bb_view_->other_bookmarked_button(); | 621 views::LabelButton* button = bb_view_->other_bookmarked_button(); |
| 622 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 622 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
| 623 ui_controls::DOWN | ui_controls::UP, | 623 ui_controls::DOWN | ui_controls::UP, |
| 624 CreateEventTask(this, &BookmarkBarViewTest4::Step2)); | 624 CreateEventTask(this, &BookmarkBarViewTest4::Step2)); |
| 625 } | 625 } |
| 626 | 626 |
| 627 private: | 627 private: |
| 628 void Step2() { | 628 void Step2() { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 } | 661 } |
| 662 | 662 |
| 663 BookmarkContextMenuNotificationObserver observer_; | 663 BookmarkContextMenuNotificationObserver observer_; |
| 664 }; | 664 }; |
| 665 | 665 |
| 666 VIEW_TEST(BookmarkBarViewTest4, ContextMenus) | 666 VIEW_TEST(BookmarkBarViewTest4, ContextMenus) |
| 667 | 667 |
| 668 // Tests drag and drop within the same menu. | 668 // Tests drag and drop within the same menu. |
| 669 class BookmarkBarViewTest5 : public BookmarkBarViewEventTestBase { | 669 class BookmarkBarViewTest5 : public BookmarkBarViewEventTestBase { |
| 670 protected: | 670 protected: |
| 671 virtual void DoTestOnMessageLoop() OVERRIDE { | 671 virtual void DoTestOnMessageLoop() override { |
| 672 url_dragging_ = | 672 url_dragging_ = |
| 673 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url(); | 673 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url(); |
| 674 | 674 |
| 675 // Move the mouse to the first folder on the bookmark bar and press the | 675 // Move the mouse to the first folder on the bookmark bar and press the |
| 676 // mouse. | 676 // mouse. |
| 677 views::LabelButton* button = GetBookmarkButton(0); | 677 views::LabelButton* button = GetBookmarkButton(0); |
| 678 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 678 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
| 679 ui_controls::DOWN | ui_controls::UP, | 679 ui_controls::DOWN | ui_controls::UP, |
| 680 CreateEventTask(this, &BookmarkBarViewTest5::Step2)); | 680 CreateEventTask(this, &BookmarkBarViewTest5::Step2)); |
| 681 } | 681 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 }; | 734 }; |
| 735 | 735 |
| 736 #if !defined(OS_WIN) // flaky http://crbug.com/400578 | 736 #if !defined(OS_WIN) // flaky http://crbug.com/400578 |
| 737 VIEW_TEST(BookmarkBarViewTest5, MAYBE(DND)) | 737 VIEW_TEST(BookmarkBarViewTest5, MAYBE(DND)) |
| 738 #endif | 738 #endif |
| 739 | 739 |
| 740 // Tests holding mouse down on overflow button, dragging such that menu pops up | 740 // Tests holding mouse down on overflow button, dragging such that menu pops up |
| 741 // then selecting an item. | 741 // then selecting an item. |
| 742 class BookmarkBarViewTest6 : public BookmarkBarViewEventTestBase { | 742 class BookmarkBarViewTest6 : public BookmarkBarViewEventTestBase { |
| 743 protected: | 743 protected: |
| 744 virtual void DoTestOnMessageLoop() OVERRIDE { | 744 virtual void DoTestOnMessageLoop() override { |
| 745 // Press the mouse button on the overflow button. Don't release it though. | 745 // Press the mouse button on the overflow button. Don't release it though. |
| 746 views::LabelButton* button = bb_view_->overflow_button(); | 746 views::LabelButton* button = bb_view_->overflow_button(); |
| 747 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 747 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
| 748 ui_controls::DOWN, CreateEventTask(this, &BookmarkBarViewTest6::Step2)); | 748 ui_controls::DOWN, CreateEventTask(this, &BookmarkBarViewTest6::Step2)); |
| 749 } | 749 } |
| 750 | 750 |
| 751 private: | 751 private: |
| 752 void Step2() { | 752 void Step2() { |
| 753 // Menu should be showing. | 753 // Menu should be showing. |
| 754 views::MenuItemView* menu = bb_view_->GetMenu(); | 754 views::MenuItemView* menu = bb_view_->GetMenu(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 771 } | 771 } |
| 772 | 772 |
| 773 GURL url_dragging_; | 773 GURL url_dragging_; |
| 774 }; | 774 }; |
| 775 | 775 |
| 776 VIEW_TEST(BookmarkBarViewTest6, OpenMenuOnClickAndHold) | 776 VIEW_TEST(BookmarkBarViewTest6, OpenMenuOnClickAndHold) |
| 777 | 777 |
| 778 // Tests drag and drop to different menu. | 778 // Tests drag and drop to different menu. |
| 779 class BookmarkBarViewTest7 : public BookmarkBarViewEventTestBase { | 779 class BookmarkBarViewTest7 : public BookmarkBarViewEventTestBase { |
| 780 protected: | 780 protected: |
| 781 virtual void DoTestOnMessageLoop() OVERRIDE { | 781 virtual void DoTestOnMessageLoop() override { |
| 782 url_dragging_ = | 782 url_dragging_ = |
| 783 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url(); | 783 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url(); |
| 784 | 784 |
| 785 // Move the mouse to the first folder on the bookmark bar and press the | 785 // Move the mouse to the first folder on the bookmark bar and press the |
| 786 // mouse. | 786 // mouse. |
| 787 views::LabelButton* button = GetBookmarkButton(0); | 787 views::LabelButton* button = GetBookmarkButton(0); |
| 788 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 788 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
| 789 ui_controls::DOWN | ui_controls::UP, | 789 ui_controls::DOWN | ui_controls::UP, |
| 790 CreateEventTask(this, &BookmarkBarViewTest7::Step2)); | 790 CreateEventTask(this, &BookmarkBarViewTest7::Step2)); |
| 791 } | 791 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 // This test passes locally (on aero and non-aero) but fails on the trybots and | 871 // This test passes locally (on aero and non-aero) but fails on the trybots and |
| 872 // buildbot. | 872 // buildbot. |
| 873 // http://crbug.com/154081 | 873 // http://crbug.com/154081 |
| 874 VIEW_TEST(BookmarkBarViewTest7, MAYBE(DNDToDifferentMenu)) | 874 VIEW_TEST(BookmarkBarViewTest7, MAYBE(DNDToDifferentMenu)) |
| 875 #endif | 875 #endif |
| 876 | 876 |
| 877 // Drags from one menu to next so that original menu closes, then back to | 877 // Drags from one menu to next so that original menu closes, then back to |
| 878 // original menu. | 878 // original menu. |
| 879 class BookmarkBarViewTest8 : public BookmarkBarViewEventTestBase { | 879 class BookmarkBarViewTest8 : public BookmarkBarViewEventTestBase { |
| 880 protected: | 880 protected: |
| 881 virtual void DoTestOnMessageLoop() OVERRIDE { | 881 virtual void DoTestOnMessageLoop() override { |
| 882 url_dragging_ = | 882 url_dragging_ = |
| 883 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url(); | 883 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url(); |
| 884 | 884 |
| 885 // Move the mouse to the first folder on the bookmark bar and press the | 885 // Move the mouse to the first folder on the bookmark bar and press the |
| 886 // mouse. | 886 // mouse. |
| 887 views::LabelButton* button = GetBookmarkButton(0); | 887 views::LabelButton* button = GetBookmarkButton(0); |
| 888 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 888 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
| 889 ui_controls::DOWN | ui_controls::UP, | 889 ui_controls::DOWN | ui_controls::UP, |
| 890 CreateEventTask(this, &BookmarkBarViewTest8::Step2)); | 890 CreateEventTask(this, &BookmarkBarViewTest8::Step2)); |
| 891 } | 891 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 #if !defined(OS_WIN) | 979 #if !defined(OS_WIN) |
| 980 // This test passes locally (on aero and non-aero) but fails on the trybots and | 980 // This test passes locally (on aero and non-aero) but fails on the trybots and |
| 981 // buildbot. | 981 // buildbot. |
| 982 // http://crbug.com/154081 | 982 // http://crbug.com/154081 |
| 983 VIEW_TEST(BookmarkBarViewTest8, MAYBE(DNDBackToOriginatingMenu)) | 983 VIEW_TEST(BookmarkBarViewTest8, MAYBE(DNDBackToOriginatingMenu)) |
| 984 #endif | 984 #endif |
| 985 | 985 |
| 986 // Moves the mouse over the scroll button and makes sure we get scrolling. | 986 // Moves the mouse over the scroll button and makes sure we get scrolling. |
| 987 class BookmarkBarViewTest9 : public BookmarkBarViewEventTestBase { | 987 class BookmarkBarViewTest9 : public BookmarkBarViewEventTestBase { |
| 988 protected: | 988 protected: |
| 989 virtual bool CreateBigMenu() OVERRIDE { return true; } | 989 virtual bool CreateBigMenu() override { return true; } |
| 990 | 990 |
| 991 virtual void DoTestOnMessageLoop() OVERRIDE { | 991 virtual void DoTestOnMessageLoop() override { |
| 992 // Move the mouse to the first folder on the bookmark bar and press the | 992 // Move the mouse to the first folder on the bookmark bar and press the |
| 993 // mouse. | 993 // mouse. |
| 994 views::LabelButton* button = GetBookmarkButton(0); | 994 views::LabelButton* button = GetBookmarkButton(0); |
| 995 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 995 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
| 996 ui_controls::DOWN | ui_controls::UP, | 996 ui_controls::DOWN | ui_controls::UP, |
| 997 CreateEventTask(this, &BookmarkBarViewTest9::Step2)); | 997 CreateEventTask(this, &BookmarkBarViewTest9::Step2)); |
| 998 } | 998 } |
| 999 | 999 |
| 1000 private: | 1000 private: |
| 1001 void Step2() { | 1001 void Step2() { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 | 1050 |
| 1051 int start_y_; | 1051 int start_y_; |
| 1052 views::MenuItemView* first_menu_; | 1052 views::MenuItemView* first_menu_; |
| 1053 }; | 1053 }; |
| 1054 | 1054 |
| 1055 VIEW_TEST(BookmarkBarViewTest9, ScrollButtonScrolls) | 1055 VIEW_TEST(BookmarkBarViewTest9, ScrollButtonScrolls) |
| 1056 | 1056 |
| 1057 // Tests up/down/left/enter key messages. | 1057 // Tests up/down/left/enter key messages. |
| 1058 class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { | 1058 class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { |
| 1059 protected: | 1059 protected: |
| 1060 virtual void DoTestOnMessageLoop() OVERRIDE { | 1060 virtual void DoTestOnMessageLoop() override { |
| 1061 // Move the mouse to the first folder on the bookmark bar and press the | 1061 // Move the mouse to the first folder on the bookmark bar and press the |
| 1062 // mouse. | 1062 // mouse. |
| 1063 views::LabelButton* button = GetBookmarkButton(0); | 1063 views::LabelButton* button = GetBookmarkButton(0); |
| 1064 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 1064 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
| 1065 ui_controls::DOWN | ui_controls::UP, | 1065 ui_controls::DOWN | ui_controls::UP, |
| 1066 CreateEventTask(this, &BookmarkBarViewTest10::Step2)); | 1066 CreateEventTask(this, &BookmarkBarViewTest10::Step2)); |
| 1067 base::MessageLoop::current()->RunUntilIdle(); | 1067 base::MessageLoop::current()->RunUntilIdle(); |
| 1068 } | 1068 } |
| 1069 | 1069 |
| 1070 private: | 1070 private: |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 // context menu, close context menu (via escape), then click else where. This | 1171 // context menu, close context menu (via escape), then click else where. This |
| 1172 // effectively verifies we maintain mouse capture after the context menu is | 1172 // effectively verifies we maintain mouse capture after the context menu is |
| 1173 // hidden. | 1173 // hidden. |
| 1174 class BookmarkBarViewTest11 : public BookmarkBarViewEventTestBase { | 1174 class BookmarkBarViewTest11 : public BookmarkBarViewEventTestBase { |
| 1175 public: | 1175 public: |
| 1176 BookmarkBarViewTest11() | 1176 BookmarkBarViewTest11() |
| 1177 : observer_(CreateEventTask(this, &BookmarkBarViewTest11::Step3)) { | 1177 : observer_(CreateEventTask(this, &BookmarkBarViewTest11::Step3)) { |
| 1178 } | 1178 } |
| 1179 | 1179 |
| 1180 protected: | 1180 protected: |
| 1181 virtual void DoTestOnMessageLoop() OVERRIDE { | 1181 virtual void DoTestOnMessageLoop() override { |
| 1182 // Move the mouse to the first folder on the bookmark bar and press the | 1182 // Move the mouse to the first folder on the bookmark bar and press the |
| 1183 // mouse. | 1183 // mouse. |
| 1184 views::LabelButton* button = bb_view_->other_bookmarked_button(); | 1184 views::LabelButton* button = bb_view_->other_bookmarked_button(); |
| 1185 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 1185 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
| 1186 ui_controls::DOWN | ui_controls::UP, | 1186 ui_controls::DOWN | ui_controls::UP, |
| 1187 CreateEventTask(this, &BookmarkBarViewTest11::Step2)); | 1187 CreateEventTask(this, &BookmarkBarViewTest11::Step2)); |
| 1188 } | 1188 } |
| 1189 | 1189 |
| 1190 private: | 1190 private: |
| 1191 void Step2() { | 1191 void Step2() { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 DISABLED_CloseMenuAfterClosingContextMenu | 1251 DISABLED_CloseMenuAfterClosingContextMenu |
| 1252 #else | 1252 #else |
| 1253 #define MAYBE_CloseMenuAfterClosingContextMenu CloseMenuAfterClosingContextMenu | 1253 #define MAYBE_CloseMenuAfterClosingContextMenu CloseMenuAfterClosingContextMenu |
| 1254 #endif | 1254 #endif |
| 1255 | 1255 |
| 1256 VIEW_TEST(BookmarkBarViewTest11, MAYBE_CloseMenuAfterClosingContextMenu) | 1256 VIEW_TEST(BookmarkBarViewTest11, MAYBE_CloseMenuAfterClosingContextMenu) |
| 1257 | 1257 |
| 1258 // Tests showing a modal dialog from a context menu. | 1258 // Tests showing a modal dialog from a context menu. |
| 1259 class BookmarkBarViewTest12 : public BookmarkBarViewEventTestBase { | 1259 class BookmarkBarViewTest12 : public BookmarkBarViewEventTestBase { |
| 1260 protected: | 1260 protected: |
| 1261 virtual void DoTestOnMessageLoop() OVERRIDE { | 1261 virtual void DoTestOnMessageLoop() override { |
| 1262 // Open up the other folder. | 1262 // Open up the other folder. |
| 1263 views::LabelButton* button = bb_view_->other_bookmarked_button(); | 1263 views::LabelButton* button = bb_view_->other_bookmarked_button(); |
| 1264 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 1264 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
| 1265 ui_controls::DOWN | ui_controls::UP, | 1265 ui_controls::DOWN | ui_controls::UP, |
| 1266 CreateEventTask(this, &BookmarkBarViewTest12::Step2)); | 1266 CreateEventTask(this, &BookmarkBarViewTest12::Step2)); |
| 1267 chrome::num_bookmark_urls_before_prompting = 1; | 1267 chrome::num_bookmark_urls_before_prompting = 1; |
| 1268 } | 1268 } |
| 1269 | 1269 |
| 1270 virtual ~BookmarkBarViewTest12() { | 1270 virtual ~BookmarkBarViewTest12() { |
| 1271 chrome::num_bookmark_urls_before_prompting = 15; | 1271 chrome::num_bookmark_urls_before_prompting = 15; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1353 | 1353 |
| 1354 // Tests clicking on the separator of a context menu (this is for coverage of | 1354 // Tests clicking on the separator of a context menu (this is for coverage of |
| 1355 // bug 17862). | 1355 // bug 17862). |
| 1356 class BookmarkBarViewTest13 : public BookmarkBarViewEventTestBase { | 1356 class BookmarkBarViewTest13 : public BookmarkBarViewEventTestBase { |
| 1357 public: | 1357 public: |
| 1358 BookmarkBarViewTest13() | 1358 BookmarkBarViewTest13() |
| 1359 : observer_(CreateEventTask(this, &BookmarkBarViewTest13::Step3)) { | 1359 : observer_(CreateEventTask(this, &BookmarkBarViewTest13::Step3)) { |
| 1360 } | 1360 } |
| 1361 | 1361 |
| 1362 protected: | 1362 protected: |
| 1363 virtual void DoTestOnMessageLoop() OVERRIDE { | 1363 virtual void DoTestOnMessageLoop() override { |
| 1364 // Move the mouse to the first folder on the bookmark bar and press the | 1364 // Move the mouse to the first folder on the bookmark bar and press the |
| 1365 // mouse. | 1365 // mouse. |
| 1366 views::LabelButton* button = bb_view_->other_bookmarked_button(); | 1366 views::LabelButton* button = bb_view_->other_bookmarked_button(); |
| 1367 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 1367 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
| 1368 ui_controls::DOWN | ui_controls::UP, | 1368 ui_controls::DOWN | ui_controls::UP, |
| 1369 CreateEventTask(this, &BookmarkBarViewTest13::Step2)); | 1369 CreateEventTask(this, &BookmarkBarViewTest13::Step2)); |
| 1370 } | 1370 } |
| 1371 | 1371 |
| 1372 private: | 1372 private: |
| 1373 void Step2() { | 1373 void Step2() { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1437 | 1437 |
| 1438 // Makes sure right clicking on a folder on the bookmark bar doesn't result in | 1438 // Makes sure right clicking on a folder on the bookmark bar doesn't result in |
| 1439 // both a context menu and showing the menu. | 1439 // both a context menu and showing the menu. |
| 1440 class BookmarkBarViewTest14 : public BookmarkBarViewEventTestBase { | 1440 class BookmarkBarViewTest14 : public BookmarkBarViewEventTestBase { |
| 1441 public: | 1441 public: |
| 1442 BookmarkBarViewTest14() | 1442 BookmarkBarViewTest14() |
| 1443 : observer_(CreateEventTask(this, &BookmarkBarViewTest14::Step2)) { | 1443 : observer_(CreateEventTask(this, &BookmarkBarViewTest14::Step2)) { |
| 1444 } | 1444 } |
| 1445 | 1445 |
| 1446 protected: | 1446 protected: |
| 1447 virtual void DoTestOnMessageLoop() OVERRIDE { | 1447 virtual void DoTestOnMessageLoop() override { |
| 1448 // Move the mouse to the first folder on the bookmark bar and press the | 1448 // Move the mouse to the first folder on the bookmark bar and press the |
| 1449 // right mouse button. | 1449 // right mouse button. |
| 1450 views::LabelButton* button = GetBookmarkButton(0); | 1450 views::LabelButton* button = GetBookmarkButton(0); |
| 1451 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::RIGHT, | 1451 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::RIGHT, |
| 1452 ui_controls::DOWN | ui_controls::UP, base::Closure()); | 1452 ui_controls::DOWN | ui_controls::UP, base::Closure()); |
| 1453 // Step2 will be invoked by BookmarkContextMenuNotificationObserver. | 1453 // Step2 will be invoked by BookmarkContextMenuNotificationObserver. |
| 1454 } | 1454 } |
| 1455 | 1455 |
| 1456 private: | 1456 private: |
| 1457 | 1457 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1484 | 1484 |
| 1485 // Makes sure deleting from the context menu keeps the bookmark menu showing. | 1485 // Makes sure deleting from the context menu keeps the bookmark menu showing. |
| 1486 class BookmarkBarViewTest15 : public BookmarkBarViewEventTestBase { | 1486 class BookmarkBarViewTest15 : public BookmarkBarViewEventTestBase { |
| 1487 public: | 1487 public: |
| 1488 BookmarkBarViewTest15() | 1488 BookmarkBarViewTest15() |
| 1489 : deleted_menu_id_(0), | 1489 : deleted_menu_id_(0), |
| 1490 observer_(CreateEventTask(this, &BookmarkBarViewTest15::Step3)) { | 1490 observer_(CreateEventTask(this, &BookmarkBarViewTest15::Step3)) { |
| 1491 } | 1491 } |
| 1492 | 1492 |
| 1493 protected: | 1493 protected: |
| 1494 virtual void DoTestOnMessageLoop() OVERRIDE { | 1494 virtual void DoTestOnMessageLoop() override { |
| 1495 // Show the other bookmarks. | 1495 // Show the other bookmarks. |
| 1496 views::LabelButton* button = bb_view_->other_bookmarked_button(); | 1496 views::LabelButton* button = bb_view_->other_bookmarked_button(); |
| 1497 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 1497 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
| 1498 ui_controls::DOWN | ui_controls::UP, | 1498 ui_controls::DOWN | ui_controls::UP, |
| 1499 CreateEventTask(this, &BookmarkBarViewTest15::Step2)); | 1499 CreateEventTask(this, &BookmarkBarViewTest15::Step2)); |
| 1500 } | 1500 } |
| 1501 | 1501 |
| 1502 private: | 1502 private: |
| 1503 void Step2() { | 1503 void Step2() { |
| 1504 // Menu should be showing. | 1504 // Menu should be showing. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1555 | 1555 |
| 1556 int deleted_menu_id_; | 1556 int deleted_menu_id_; |
| 1557 BookmarkContextMenuNotificationObserver observer_; | 1557 BookmarkContextMenuNotificationObserver observer_; |
| 1558 }; | 1558 }; |
| 1559 | 1559 |
| 1560 VIEW_TEST(BookmarkBarViewTest15, MenuStaysVisibleAfterDelete) | 1560 VIEW_TEST(BookmarkBarViewTest15, MenuStaysVisibleAfterDelete) |
| 1561 | 1561 |
| 1562 // Tests that we don't crash or get stuck if the parent of a menu is closed. | 1562 // Tests that we don't crash or get stuck if the parent of a menu is closed. |
| 1563 class BookmarkBarViewTest16 : public BookmarkBarViewEventTestBase { | 1563 class BookmarkBarViewTest16 : public BookmarkBarViewEventTestBase { |
| 1564 protected: | 1564 protected: |
| 1565 virtual void DoTestOnMessageLoop() OVERRIDE { | 1565 virtual void DoTestOnMessageLoop() override { |
| 1566 // Move the mouse to the first folder on the bookmark bar and press the | 1566 // Move the mouse to the first folder on the bookmark bar and press the |
| 1567 // mouse. | 1567 // mouse. |
| 1568 views::LabelButton* button = GetBookmarkButton(0); | 1568 views::LabelButton* button = GetBookmarkButton(0); |
| 1569 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 1569 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
| 1570 ui_controls::DOWN | ui_controls::UP, | 1570 ui_controls::DOWN | ui_controls::UP, |
| 1571 CreateEventTask(this, &BookmarkBarViewTest16::Step2)); | 1571 CreateEventTask(this, &BookmarkBarViewTest16::Step2)); |
| 1572 } | 1572 } |
| 1573 | 1573 |
| 1574 private: | 1574 private: |
| 1575 void Step2() { | 1575 void Step2() { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1602 | 1602 |
| 1603 // Makes sure right clicking on an item while a context menu is already showing | 1603 // Makes sure right clicking on an item while a context menu is already showing |
| 1604 // doesn't crash and works. | 1604 // doesn't crash and works. |
| 1605 class BookmarkBarViewTest17 : public BookmarkBarViewEventTestBase { | 1605 class BookmarkBarViewTest17 : public BookmarkBarViewEventTestBase { |
| 1606 public: | 1606 public: |
| 1607 BookmarkBarViewTest17() | 1607 BookmarkBarViewTest17() |
| 1608 : observer_(CreateEventTask(this, &BookmarkBarViewTest17::Step3)) { | 1608 : observer_(CreateEventTask(this, &BookmarkBarViewTest17::Step3)) { |
| 1609 } | 1609 } |
| 1610 | 1610 |
| 1611 protected: | 1611 protected: |
| 1612 virtual void DoTestOnMessageLoop() OVERRIDE { | 1612 virtual void DoTestOnMessageLoop() override { |
| 1613 // Move the mouse to the other folder on the bookmark bar and press the | 1613 // Move the mouse to the other folder on the bookmark bar and press the |
| 1614 // left mouse button. | 1614 // left mouse button. |
| 1615 views::LabelButton* button = bb_view_->other_bookmarked_button(); | 1615 views::LabelButton* button = bb_view_->other_bookmarked_button(); |
| 1616 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 1616 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
| 1617 ui_controls::DOWN | ui_controls::UP, | 1617 ui_controls::DOWN | ui_controls::UP, |
| 1618 CreateEventTask(this, &BookmarkBarViewTest17::Step2)); | 1618 CreateEventTask(this, &BookmarkBarViewTest17::Step2)); |
| 1619 } | 1619 } |
| 1620 | 1620 |
| 1621 private: | 1621 private: |
| 1622 void Step2() { | 1622 void Step2() { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1691 #define MAYBE_ContextMenus3 ContextMenus3 | 1691 #define MAYBE_ContextMenus3 ContextMenus3 |
| 1692 #endif | 1692 #endif |
| 1693 | 1693 |
| 1694 VIEW_TEST(BookmarkBarViewTest17, MAYBE_ContextMenus3) | 1694 VIEW_TEST(BookmarkBarViewTest17, MAYBE_ContextMenus3) |
| 1695 | 1695 |
| 1696 // Verifies sibling menus works. Clicks on the 'other bookmarks' folder, then | 1696 // Verifies sibling menus works. Clicks on the 'other bookmarks' folder, then |
| 1697 // moves the mouse over the first item on the bookmark bar and makes sure the | 1697 // moves the mouse over the first item on the bookmark bar and makes sure the |
| 1698 // menu appears. | 1698 // menu appears. |
| 1699 class BookmarkBarViewTest18 : public BookmarkBarViewEventTestBase { | 1699 class BookmarkBarViewTest18 : public BookmarkBarViewEventTestBase { |
| 1700 protected: | 1700 protected: |
| 1701 virtual void DoTestOnMessageLoop() OVERRIDE { | 1701 virtual void DoTestOnMessageLoop() override { |
| 1702 // Move the mouse to the other folder on the bookmark bar and press the | 1702 // Move the mouse to the other folder on the bookmark bar and press the |
| 1703 // left mouse button. | 1703 // left mouse button. |
| 1704 views::LabelButton* button = bb_view_->other_bookmarked_button(); | 1704 views::LabelButton* button = bb_view_->other_bookmarked_button(); |
| 1705 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 1705 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
| 1706 ui_controls::DOWN | ui_controls::UP, | 1706 ui_controls::DOWN | ui_controls::UP, |
| 1707 CreateEventTask(this, &BookmarkBarViewTest18::Step2)); | 1707 CreateEventTask(this, &BookmarkBarViewTest18::Step2)); |
| 1708 } | 1708 } |
| 1709 | 1709 |
| 1710 private: | 1710 private: |
| 1711 void Step2() { | 1711 void Step2() { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1748 #define MAYBE_BookmarkBarViewTest18_SiblingMenu \ | 1748 #define MAYBE_BookmarkBarViewTest18_SiblingMenu \ |
| 1749 BookmarkBarViewTest18_SiblingMenu | 1749 BookmarkBarViewTest18_SiblingMenu |
| 1750 #endif | 1750 #endif |
| 1751 | 1751 |
| 1752 VIEW_TEST(BookmarkBarViewTest18, MAYBE_BookmarkBarViewTest18_SiblingMenu) | 1752 VIEW_TEST(BookmarkBarViewTest18, MAYBE_BookmarkBarViewTest18_SiblingMenu) |
| 1753 | 1753 |
| 1754 // Verifies mousing over an already open sibling menu doesn't prematurely cancel | 1754 // Verifies mousing over an already open sibling menu doesn't prematurely cancel |
| 1755 // the menu. | 1755 // the menu. |
| 1756 class BookmarkBarViewTest19 : public BookmarkBarViewEventTestBase { | 1756 class BookmarkBarViewTest19 : public BookmarkBarViewEventTestBase { |
| 1757 protected: | 1757 protected: |
| 1758 virtual void DoTestOnMessageLoop() OVERRIDE { | 1758 virtual void DoTestOnMessageLoop() override { |
| 1759 // Move the mouse to the other folder on the bookmark bar and press the | 1759 // Move the mouse to the other folder on the bookmark bar and press the |
| 1760 // left mouse button. | 1760 // left mouse button. |
| 1761 views::LabelButton* button = bb_view_->other_bookmarked_button(); | 1761 views::LabelButton* button = bb_view_->other_bookmarked_button(); |
| 1762 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 1762 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
| 1763 ui_controls::DOWN | ui_controls::UP, | 1763 ui_controls::DOWN | ui_controls::UP, |
| 1764 CreateEventTask(this, &BookmarkBarViewTest19::Step2)); | 1764 CreateEventTask(this, &BookmarkBarViewTest19::Step2)); |
| 1765 } | 1765 } |
| 1766 | 1766 |
| 1767 private: | 1767 private: |
| 1768 void Step2() { | 1768 void Step2() { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1826 VIEW_TEST(BookmarkBarViewTest19, BookmarkBarViewTest19_SiblingMenu) | 1826 VIEW_TEST(BookmarkBarViewTest19, BookmarkBarViewTest19_SiblingMenu) |
| 1827 | 1827 |
| 1828 // Verify that when clicking a mouse button outside a context menu, | 1828 // Verify that when clicking a mouse button outside a context menu, |
| 1829 // the context menu is dismissed *and* the underlying view receives | 1829 // the context menu is dismissed *and* the underlying view receives |
| 1830 // the the mouse event (due to event reposting). | 1830 // the the mouse event (due to event reposting). |
| 1831 class BookmarkBarViewTest20 : public BookmarkBarViewEventTestBase { | 1831 class BookmarkBarViewTest20 : public BookmarkBarViewEventTestBase { |
| 1832 public: | 1832 public: |
| 1833 BookmarkBarViewTest20() : test_view_(new TestViewForMenuExit) {} | 1833 BookmarkBarViewTest20() : test_view_(new TestViewForMenuExit) {} |
| 1834 | 1834 |
| 1835 protected: | 1835 protected: |
| 1836 virtual void DoTestOnMessageLoop() OVERRIDE { | 1836 virtual void DoTestOnMessageLoop() override { |
| 1837 // Add |test_view_| next to |bb_view_|. | 1837 // Add |test_view_| next to |bb_view_|. |
| 1838 views::View* parent = bb_view_->parent(); | 1838 views::View* parent = bb_view_->parent(); |
| 1839 views::View* container_view = new ContainerViewForMenuExit; | 1839 views::View* container_view = new ContainerViewForMenuExit; |
| 1840 container_view->AddChildView(bb_view_.get()); | 1840 container_view->AddChildView(bb_view_.get()); |
| 1841 container_view->AddChildView(test_view_); | 1841 container_view->AddChildView(test_view_); |
| 1842 parent->AddChildView(container_view); | 1842 parent->AddChildView(container_view); |
| 1843 parent->Layout(); | 1843 parent->Layout(); |
| 1844 | 1844 |
| 1845 ASSERT_EQ(test_view_->press_count(), 0); | 1845 ASSERT_EQ(test_view_->press_count(), 0); |
| 1846 | 1846 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1882 ASSERT_EQ(test_view_->press_count(), 2); | 1882 ASSERT_EQ(test_view_->press_count(), 2); |
| 1883 ASSERT_TRUE(bb_view_->GetMenu() == NULL); | 1883 ASSERT_TRUE(bb_view_->GetMenu() == NULL); |
| 1884 Done(); | 1884 Done(); |
| 1885 } | 1885 } |
| 1886 | 1886 |
| 1887 class ContainerViewForMenuExit : public views::View { | 1887 class ContainerViewForMenuExit : public views::View { |
| 1888 public: | 1888 public: |
| 1889 ContainerViewForMenuExit() { | 1889 ContainerViewForMenuExit() { |
| 1890 } | 1890 } |
| 1891 | 1891 |
| 1892 virtual void Layout() OVERRIDE { | 1892 virtual void Layout() override { |
| 1893 DCHECK_EQ(2, child_count()); | 1893 DCHECK_EQ(2, child_count()); |
| 1894 views::View* bb_view = child_at(0); | 1894 views::View* bb_view = child_at(0); |
| 1895 views::View* test_view = child_at(1); | 1895 views::View* test_view = child_at(1); |
| 1896 const int width = bb_view->width(); | 1896 const int width = bb_view->width(); |
| 1897 const int height = bb_view->height(); | 1897 const int height = bb_view->height(); |
| 1898 bb_view->SetBounds(0,0, width - 22, height); | 1898 bb_view->SetBounds(0,0, width - 22, height); |
| 1899 test_view->SetBounds(width - 20, 0, 20, height); | 1899 test_view->SetBounds(width - 20, 0, 20, height); |
| 1900 } | 1900 } |
| 1901 | 1901 |
| 1902 private: | 1902 private: |
| 1903 | 1903 |
| 1904 DISALLOW_COPY_AND_ASSIGN(ContainerViewForMenuExit); | 1904 DISALLOW_COPY_AND_ASSIGN(ContainerViewForMenuExit); |
| 1905 }; | 1905 }; |
| 1906 | 1906 |
| 1907 class TestViewForMenuExit : public views::View { | 1907 class TestViewForMenuExit : public views::View { |
| 1908 public: | 1908 public: |
| 1909 TestViewForMenuExit() : press_count_(0) { | 1909 TestViewForMenuExit() : press_count_(0) { |
| 1910 } | 1910 } |
| 1911 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE { | 1911 virtual bool OnMousePressed(const ui::MouseEvent& event) override { |
| 1912 ++press_count_; | 1912 ++press_count_; |
| 1913 return true; | 1913 return true; |
| 1914 } | 1914 } |
| 1915 int press_count() const { return press_count_; } | 1915 int press_count() const { return press_count_; } |
| 1916 | 1916 |
| 1917 private: | 1917 private: |
| 1918 int press_count_; | 1918 int press_count_; |
| 1919 | 1919 |
| 1920 DISALLOW_COPY_AND_ASSIGN(TestViewForMenuExit); | 1920 DISALLOW_COPY_AND_ASSIGN(TestViewForMenuExit); |
| 1921 }; | 1921 }; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1936 // The opened context menu should behave as it is from the folder button. | 1936 // The opened context menu should behave as it is from the folder button. |
| 1937 class BookmarkBarViewTest21 : public BookmarkBarViewEventTestBase { | 1937 class BookmarkBarViewTest21 : public BookmarkBarViewEventTestBase { |
| 1938 public: | 1938 public: |
| 1939 BookmarkBarViewTest21() | 1939 BookmarkBarViewTest21() |
| 1940 : observer_(CreateEventTask(this, &BookmarkBarViewTest21::Step3)) { | 1940 : observer_(CreateEventTask(this, &BookmarkBarViewTest21::Step3)) { |
| 1941 } | 1941 } |
| 1942 | 1942 |
| 1943 protected: | 1943 protected: |
| 1944 // Move the mouse to the empty folder on the bookmark bar and press the | 1944 // Move the mouse to the empty folder on the bookmark bar and press the |
| 1945 // left mouse button. | 1945 // left mouse button. |
| 1946 virtual void DoTestOnMessageLoop() OVERRIDE { | 1946 virtual void DoTestOnMessageLoop() override { |
| 1947 views::LabelButton* button = GetBookmarkButton(5); | 1947 views::LabelButton* button = GetBookmarkButton(5); |
| 1948 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 1948 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
| 1949 ui_controls::DOWN | ui_controls::UP, | 1949 ui_controls::DOWN | ui_controls::UP, |
| 1950 CreateEventTask(this, &BookmarkBarViewTest21::Step2)); | 1950 CreateEventTask(this, &BookmarkBarViewTest21::Step2)); |
| 1951 } | 1951 } |
| 1952 | 1952 |
| 1953 private: | 1953 private: |
| 1954 // Confirm that a menu for empty folder shows and right click the menu. | 1954 // Confirm that a menu for empty folder shows and right click the menu. |
| 1955 void Step2() { | 1955 void Step2() { |
| 1956 // Menu should be showing. | 1956 // Menu should be showing. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1997 EXPECT_TRUE(bb_view_->GetContextMenu() == NULL); | 1997 EXPECT_TRUE(bb_view_->GetContextMenu() == NULL); |
| 1998 EXPECT_TRUE(bb_view_->GetMenu() == NULL); | 1998 EXPECT_TRUE(bb_view_->GetMenu() == NULL); |
| 1999 | 1999 |
| 2000 Done(); | 2000 Done(); |
| 2001 } | 2001 } |
| 2002 | 2002 |
| 2003 BookmarkContextMenuNotificationObserver observer_; | 2003 BookmarkContextMenuNotificationObserver observer_; |
| 2004 }; | 2004 }; |
| 2005 | 2005 |
| 2006 VIEW_TEST(BookmarkBarViewTest21, ContextMenusForEmptyFolder) | 2006 VIEW_TEST(BookmarkBarViewTest21, ContextMenusForEmptyFolder) |
| OLD | NEW |