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 "chrome/app/chrome_command_ids.h" | 5 #include "chrome/app/chrome_command_ids.h" |
6 #include "chrome/browser/extensions/api/commands/command_service.h" | 6 #include "chrome/browser/extensions/api/commands/command_service.h" |
7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_commands.h" | 9 #include "chrome/browser/ui/browser_commands.h" |
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 const char kBookmarkKeybinding[] = "Command+D"; | 25 const char kBookmarkKeybinding[] = "Command+D"; |
26 #else | 26 #else |
27 const char kBookmarkKeybinding[] = "Ctrl+D"; | 27 const char kBookmarkKeybinding[] = "Ctrl+D"; |
28 #endif // defined(OS_MACOSX) | 28 #endif // defined(OS_MACOSX) |
29 } | 29 } |
30 | 30 |
31 // Test that clicking the star brings up the bookmark UI, if no extension | 31 // Test that clicking the star brings up the bookmark UI, if no extension |
32 // requests to override ctrl-D and the user has assigned it to an extension. | 32 // requests to override ctrl-D and the user has assigned it to an extension. |
33 // Flaky on all platforms: https://crbug.com/448956. | 33 // Flaky on all platforms: https://crbug.com/448956. |
34 IN_PROC_BROWSER_TEST_F(BookmarkOverrideTest, DISABLED_NonOverrideStarClick) { | 34 IN_PROC_BROWSER_TEST_F(BookmarkOverrideTest, DISABLED_NonOverrideStarClick) { |
35 ASSERT_TRUE(test_server()->Start()); | 35 ASSERT_TRUE(embedded_test_server()->Start()); |
36 ASSERT_TRUE(RunExtensionTest("keybinding/basics")) << message_; | 36 ASSERT_TRUE(RunExtensionTest("keybinding/basics")) << message_; |
37 const extensions::Extension* extension = GetSingleLoadedExtension(); | 37 const extensions::Extension* extension = GetSingleLoadedExtension(); |
38 | 38 |
39 extensions::CommandService* command_service = | 39 extensions::CommandService* command_service = |
40 extensions::CommandService::Get(browser()->profile()); | 40 extensions::CommandService::Get(browser()->profile()); |
41 | 41 |
42 // Simulate the user setting the keybinding to Ctrl+D. | 42 // Simulate the user setting the keybinding to Ctrl+D. |
43 command_service->UpdateKeybindingPrefs( | 43 command_service->UpdateKeybindingPrefs( |
44 extension->id(), extensions::manifest_values::kBrowserActionCommandEvent, | 44 extension->id(), extensions::manifest_values::kBrowserActionCommandEvent, |
45 kBookmarkKeybinding); | 45 kBookmarkKeybinding); |
(...skipping 17 matching lines...) Expand all Loading... |
63 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); | 63 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); |
64 star_view->OnMouseReleased(released_event); | 64 star_view->OnMouseReleased(released_event); |
65 EXPECT_TRUE(BookmarkBubbleView::bookmark_bubble()); | 65 EXPECT_TRUE(BookmarkBubbleView::bookmark_bubble()); |
66 } | 66 } |
67 | 67 |
68 // Test that invoking the IDC_BOOKMARK_PAGE command (as done by the wrench menu) | 68 // Test that invoking the IDC_BOOKMARK_PAGE command (as done by the wrench menu) |
69 // brings up the bookmark UI, if no extension requests to override ctrl-D and | 69 // brings up the bookmark UI, if no extension requests to override ctrl-D and |
70 // the user has assigned it to an extension. | 70 // the user has assigned it to an extension. |
71 // Flaky on all platforms: https://crbug.com/448956. | 71 // Flaky on all platforms: https://crbug.com/448956. |
72 IN_PROC_BROWSER_TEST_F(BookmarkOverrideTest, DISABLED_NonOverrideBookmarkPage) { | 72 IN_PROC_BROWSER_TEST_F(BookmarkOverrideTest, DISABLED_NonOverrideBookmarkPage) { |
73 ASSERT_TRUE(test_server()->Start()); | 73 ASSERT_TRUE(embedded_test_server()->Start()); |
74 ASSERT_TRUE(RunExtensionTest("keybinding/basics")) << message_; | 74 ASSERT_TRUE(RunExtensionTest("keybinding/basics")) << message_; |
75 const extensions::Extension* extension = GetSingleLoadedExtension(); | 75 const extensions::Extension* extension = GetSingleLoadedExtension(); |
76 | 76 |
77 extensions::CommandService* command_service = | 77 extensions::CommandService* command_service = |
78 extensions::CommandService::Get(browser()->profile()); | 78 extensions::CommandService::Get(browser()->profile()); |
79 | 79 |
80 // Simulate the user setting the keybinding to Ctrl+D. | 80 // Simulate the user setting the keybinding to Ctrl+D. |
81 command_service->UpdateKeybindingPrefs( | 81 command_service->UpdateKeybindingPrefs( |
82 extension->id(), extensions::manifest_values::kBrowserActionCommandEvent, | 82 extension->id(), extensions::manifest_values::kBrowserActionCommandEvent, |
83 kBookmarkKeybinding); | 83 kBookmarkKeybinding); |
84 | 84 |
85 // Check that the BookmarkBubbleView is shown when executing | 85 // Check that the BookmarkBubbleView is shown when executing |
86 // IDC_BOOKMARK_PAGE. | 86 // IDC_BOOKMARK_PAGE. |
87 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); | 87 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); |
88 chrome::ExecuteCommand(browser(), IDC_BOOKMARK_PAGE); | 88 chrome::ExecuteCommand(browser(), IDC_BOOKMARK_PAGE); |
89 EXPECT_TRUE(BookmarkBubbleView::bookmark_bubble()); | 89 EXPECT_TRUE(BookmarkBubbleView::bookmark_bubble()); |
90 } | 90 } |
OLD | NEW |