| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 extensions::CommandService::Get(browser()->profile()); | 42 extensions::CommandService::Get(browser()->profile()); |
| 43 | 43 |
| 44 // Simulate the user setting the keybinding to Ctrl+D. | 44 // Simulate the user setting the keybinding to Ctrl+D. |
| 45 command_service->UpdateKeybindingPrefs( | 45 command_service->UpdateKeybindingPrefs( |
| 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 = | 52 views::View* star_view = browser_view->toolbar()->location_bar()->star_view(); |
| 53 browser_view->GetToolbarView()->location_bar()->star_view(); | |
| 54 | 53 |
| 55 ui::MouseEvent pressed_event( | 54 ui::MouseEvent pressed_event( |
| 56 ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), | 55 ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), |
| 57 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 56 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); |
| 58 ui::MouseEvent released_event( | 57 ui::MouseEvent released_event( |
| 59 ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), | 58 ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), |
| 60 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 59 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); |
| 61 | 60 |
| 62 // Verify that clicking once shows the bookmark bubble. | 61 // Verify that clicking once shows the bookmark bubble. |
| 63 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); | 62 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 83 command_service->UpdateKeybindingPrefs( | 82 command_service->UpdateKeybindingPrefs( |
| 84 extension->id(), extensions::manifest_values::kBrowserActionCommandEvent, | 83 extension->id(), extensions::manifest_values::kBrowserActionCommandEvent, |
| 85 kBookmarkKeybinding); | 84 kBookmarkKeybinding); |
| 86 | 85 |
| 87 // Check that the BookmarkBubbleView is shown when executing | 86 // Check that the BookmarkBubbleView is shown when executing |
| 88 // IDC_BOOKMARK_PAGE. | 87 // IDC_BOOKMARK_PAGE. |
| 89 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); | 88 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); |
| 90 chrome::ExecuteCommand(browser(), IDC_BOOKMARK_PAGE); | 89 chrome::ExecuteCommand(browser(), IDC_BOOKMARK_PAGE); |
| 91 EXPECT_TRUE(BookmarkBubbleView::bookmark_bubble()); | 90 EXPECT_TRUE(BookmarkBubbleView::bookmark_bubble()); |
| 92 } | 91 } |
| OLD | NEW |