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

Side by Side Diff: chrome/browser/ui/views/extensions/bookmark_override_browsertest.cc

Issue 1409163006: Migrating tests to use EmbeddedTestServer (/chrome/browser misc) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix rebase bug. Created 5 years, 1 month 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
OLDNEW
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"
11 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" 11 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h"
12 #include "chrome/browser/ui/views/frame/browser_view.h" 12 #include "chrome/browser/ui/views/frame/browser_view.h"
13 #include "chrome/browser/ui/views/location_bar/star_view.h" 13 #include "chrome/browser/ui/views/location_bar/star_view.h"
14 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" 14 #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
15 #include "chrome/test/base/ui_test_utils.h" 15 #include "chrome/test/base/ui_test_utils.h"
16 #include "extensions/common/manifest_constants.h" 16 #include "extensions/common/manifest_constants.h"
17 #include "extensions/test/result_catcher.h" 17 #include "extensions/test/result_catcher.h"
18 #include "net/test/embedded_test_server/embedded_test_server.h"
18 #include "ui/events/event_utils.h" 19 #include "ui/events/event_utils.h"
19 20
20 typedef ExtensionApiTest BookmarkOverrideTest; 21 typedef ExtensionApiTest BookmarkOverrideTest;
21 22
22 namespace { 23 namespace {
23 // Bookmark this page keybinding. 24 // Bookmark this page keybinding.
24 #if defined(OS_MACOSX) 25 #if defined(OS_MACOSX)
25 const char kBookmarkKeybinding[] = "Command+D"; 26 const char kBookmarkKeybinding[] = "Command+D";
26 #else 27 #else
27 const char kBookmarkKeybinding[] = "Ctrl+D"; 28 const char kBookmarkKeybinding[] = "Ctrl+D";
28 #endif // defined(OS_MACOSX) 29 #endif // defined(OS_MACOSX)
29 } 30 }
30 31
31 // Test that clicking the star brings up the bookmark UI, if no extension 32 // 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. 33 // requests to override ctrl-D and the user has assigned it to an extension.
33 // Flaky on all platforms: https://crbug.com/448956. 34 // Flaky on all platforms: https://crbug.com/448956.
34 IN_PROC_BROWSER_TEST_F(BookmarkOverrideTest, DISABLED_NonOverrideStarClick) { 35 IN_PROC_BROWSER_TEST_F(BookmarkOverrideTest, DISABLED_NonOverrideStarClick) {
35 ASSERT_TRUE(test_server()->Start()); 36 ASSERT_TRUE(embedded_test_server()->Start());
36 ASSERT_TRUE(RunExtensionTest("keybinding/basics")) << message_; 37 ASSERT_TRUE(RunExtensionTest("keybinding/basics")) << message_;
37 const extensions::Extension* extension = GetSingleLoadedExtension(); 38 const extensions::Extension* extension = GetSingleLoadedExtension();
38 39
39 extensions::CommandService* command_service = 40 extensions::CommandService* command_service =
40 extensions::CommandService::Get(browser()->profile()); 41 extensions::CommandService::Get(browser()->profile());
41 42
42 // Simulate the user setting the keybinding to Ctrl+D. 43 // Simulate the user setting the keybinding to Ctrl+D.
43 command_service->UpdateKeybindingPrefs( 44 command_service->UpdateKeybindingPrefs(
44 extension->id(), extensions::manifest_values::kBrowserActionCommandEvent, 45 extension->id(), extensions::manifest_values::kBrowserActionCommandEvent,
45 kBookmarkKeybinding); 46 kBookmarkKeybinding);
(...skipping 17 matching lines...) Expand all
63 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); 64 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble());
64 star_view->OnMouseReleased(released_event); 65 star_view->OnMouseReleased(released_event);
65 EXPECT_TRUE(BookmarkBubbleView::bookmark_bubble()); 66 EXPECT_TRUE(BookmarkBubbleView::bookmark_bubble());
66 } 67 }
67 68
68 // Test that invoking the IDC_BOOKMARK_PAGE command (as done by the app menu) 69 // Test that invoking the IDC_BOOKMARK_PAGE command (as done by the app menu)
69 // brings up the bookmark UI, if no extension requests to override ctrl-D and 70 // brings up the bookmark UI, if no extension requests to override ctrl-D and
70 // the user has assigned it to an extension. 71 // the user has assigned it to an extension.
71 // Flaky on all platforms: https://crbug.com/448956. 72 // Flaky on all platforms: https://crbug.com/448956.
72 IN_PROC_BROWSER_TEST_F(BookmarkOverrideTest, DISABLED_NonOverrideBookmarkPage) { 73 IN_PROC_BROWSER_TEST_F(BookmarkOverrideTest, DISABLED_NonOverrideBookmarkPage) {
73 ASSERT_TRUE(test_server()->Start()); 74 ASSERT_TRUE(embedded_test_server()->Start());
74 ASSERT_TRUE(RunExtensionTest("keybinding/basics")) << message_; 75 ASSERT_TRUE(RunExtensionTest("keybinding/basics")) << message_;
75 const extensions::Extension* extension = GetSingleLoadedExtension(); 76 const extensions::Extension* extension = GetSingleLoadedExtension();
76 77
77 extensions::CommandService* command_service = 78 extensions::CommandService* command_service =
78 extensions::CommandService::Get(browser()->profile()); 79 extensions::CommandService::Get(browser()->profile());
79 80
80 // Simulate the user setting the keybinding to Ctrl+D. 81 // Simulate the user setting the keybinding to Ctrl+D.
81 command_service->UpdateKeybindingPrefs( 82 command_service->UpdateKeybindingPrefs(
82 extension->id(), extensions::manifest_values::kBrowserActionCommandEvent, 83 extension->id(), extensions::manifest_values::kBrowserActionCommandEvent,
83 kBookmarkKeybinding); 84 kBookmarkKeybinding);
84 85
85 // Check that the BookmarkBubbleView is shown when executing 86 // Check that the BookmarkBubbleView is shown when executing
86 // IDC_BOOKMARK_PAGE. 87 // IDC_BOOKMARK_PAGE.
87 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble()); 88 EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble());
88 chrome::ExecuteCommand(browser(), IDC_BOOKMARK_PAGE); 89 chrome::ExecuteCommand(browser(), IDC_BOOKMARK_PAGE);
89 EXPECT_TRUE(BookmarkBubbleView::bookmark_bubble()); 90 EXPECT_TRUE(BookmarkBubbleView::bookmark_bubble());
90 } 91 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698