| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 #include "chrome/app/chrome_command_ids.h" | 6 #include "chrome/app/chrome_command_ids.h" |
| 7 #include "chrome/browser/extensions/api/commands/command_service.h" | 7 #include "chrome/browser/extensions/api/commands/command_service.h" |
| 8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 extension->id(), extensions::manifest_values::kBrowserActionCommandEvent, | 46 extension->id(), extensions::manifest_values::kBrowserActionCommandEvent, |
| 47 kBookmarkKeybinding); | 47 kBookmarkKeybinding); |
| 48 | 48 |
| 49 // Check that the BookmarkBubbleView is shown when clicking on the star. | 49 // Check that the BookmarkBubbleView is shown when clicking on the star. |
| 50 BrowserView* browser_view = reinterpret_cast<BrowserView*>( | 50 BrowserView* browser_view = reinterpret_cast<BrowserView*>( |
| 51 browser()->window()); | 51 browser()->window()); |
| 52 views::View* star_view = browser_view->toolbar()->location_bar()->star_view(); | 52 views::View* star_view = browser_view->toolbar()->location_bar()->star_view(); |
| 53 | 53 |
| 54 ui::MouseEvent pressed_event( | 54 ui::MouseEvent pressed_event( |
| 55 ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), | 55 ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), |
| 56 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 56 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
| 57 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 57 ui::MouseEvent released_event( | 58 ui::MouseEvent released_event( |
| 58 ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), | 59 ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), |
| 59 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 60 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
| 61 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 60 | 62 |
| 61 // Verify that clicking once shows the bookmark bubble. | 63 // Verify that clicking once shows the bookmark bubble. |
| 62 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); | 64 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); |
| 63 star_view->OnMousePressed(pressed_event); | 65 star_view->OnMousePressed(pressed_event); |
| 64 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); | 66 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); |
| 65 star_view->OnMouseReleased(released_event); | 67 star_view->OnMouseReleased(released_event); |
| 66 EXPECT_TRUE(BookmarkBubbleView::bookmark_bubble()); | 68 EXPECT_TRUE(BookmarkBubbleView::bookmark_bubble()); |
| 67 } | 69 } |
| 68 | 70 |
| 69 // Test that invoking the IDC_BOOKMARK_PAGE command (as done by the app menu) | 71 // Test that invoking the IDC_BOOKMARK_PAGE command (as done by the app menu) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 82 command_service->UpdateKeybindingPrefs( | 84 command_service->UpdateKeybindingPrefs( |
| 83 extension->id(), extensions::manifest_values::kBrowserActionCommandEvent, | 85 extension->id(), extensions::manifest_values::kBrowserActionCommandEvent, |
| 84 kBookmarkKeybinding); | 86 kBookmarkKeybinding); |
| 85 | 87 |
| 86 // Check that the BookmarkBubbleView is shown when executing | 88 // Check that the BookmarkBubbleView is shown when executing |
| 87 // IDC_BOOKMARK_PAGE. | 89 // IDC_BOOKMARK_PAGE. |
| 88 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); | 90 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); |
| 89 chrome::ExecuteCommand(browser(), IDC_BOOKMARK_PAGE); | 91 chrome::ExecuteCommand(browser(), IDC_BOOKMARK_PAGE); |
| 90 EXPECT_TRUE(BookmarkBubbleView::bookmark_bubble()); | 92 EXPECT_TRUE(BookmarkBubbleView::bookmark_bubble()); |
| 91 } | 93 } |
| OLD | NEW |