Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / ui / extensions / extension_message_bubble_browsertest.cc
blobff3b3c4b60a9f551548b79bd2da9e23ca5f4c2f5
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/extensions/extension_message_bubble_browsertest.h"
7 #include "base/run_loop.h"
8 #include "chrome/browser/extensions/extension_action_test_util.h"
9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/ui/extensions/extension_message_bubble_factory.h"
11 #include "extensions/common/feature_switch.h"
13 ExtensionMessageBubbleBrowserTest::ExtensionMessageBubbleBrowserTest() {
16 ExtensionMessageBubbleBrowserTest::~ExtensionMessageBubbleBrowserTest() {
19 void ExtensionMessageBubbleBrowserTest::SetUpCommandLine(
20 base::CommandLine* command_line) {
21 BrowserActionsBarBrowserTest::SetUpCommandLine(command_line);
22 // The dev mode warning bubble is an easy one to trigger, so we use that for
23 // our testing purposes.
24 dev_mode_bubble_override_.reset(
25 new extensions::FeatureSwitch::ScopedOverride(
26 extensions::FeatureSwitch::force_dev_mode_highlighting(),
27 true));
28 ExtensionMessageBubbleFactory::set_override_for_tests(
29 ExtensionMessageBubbleFactory::OVERRIDE_ENABLED);
32 void ExtensionMessageBubbleBrowserTest::TestBubbleAnchoredToExtensionAction() {
33 scoped_refptr<const extensions::Extension> action_extension =
34 extensions::extension_action_test_util::CreateActionExtension(
35 "action_extension",
36 extensions::extension_action_test_util::BROWSER_ACTION,
37 extensions::Manifest::UNPACKED);
38 extension_service()->AddExtension(action_extension.get());
40 Browser* second_browser = new Browser(
41 Browser::CreateParams(profile(), browser()->host_desktop_type()));
42 base::RunLoop().RunUntilIdle();
44 CheckBubble(second_browser, ANCHOR_BROWSER_ACTION);
45 CloseBubble(second_browser);
48 void ExtensionMessageBubbleBrowserTest::TestBubbleAnchoredToWrenchMenu() {
49 scoped_refptr<const extensions::Extension> no_action_extension =
50 extensions::extension_action_test_util::CreateActionExtension(
51 "no_action_extension",
52 extensions::extension_action_test_util::NO_ACTION,
53 extensions::Manifest::UNPACKED);
54 extension_service()->AddExtension(no_action_extension.get());
56 Browser* second_browser = new Browser(
57 Browser::CreateParams(profile(), browser()->host_desktop_type()));
58 base::RunLoop().RunUntilIdle();
60 CheckBubble(second_browser, ANCHOR_WRENCH_MENU);
61 CloseBubble(second_browser);
64 void ExtensionMessageBubbleBrowserTest::
65 TestBubbleAnchoredToWrenchMenuWithOtherAction() {
66 scoped_refptr<const extensions::Extension> no_action_extension =
67 extensions::extension_action_test_util::CreateActionExtension(
68 "no_action_extension",
69 extensions::extension_action_test_util::NO_ACTION,
70 extensions::Manifest::UNPACKED);
71 extension_service()->AddExtension(no_action_extension.get());
73 scoped_refptr<const extensions::Extension> action_extension =
74 extensions::extension_action_test_util::CreateActionExtension(
75 "action_extension",
76 extensions::extension_action_test_util::BROWSER_ACTION,
77 extensions::Manifest::INTERNAL);
78 extension_service()->AddExtension(action_extension.get());
80 Browser* second_browser = new Browser(
81 Browser::CreateParams(profile(), browser()->host_desktop_type()));
82 base::RunLoop().RunUntilIdle();
84 CheckBubble(second_browser, ANCHOR_WRENCH_MENU);
85 CloseBubble(second_browser);
88 void ExtensionMessageBubbleBrowserTest::PreBubbleShowsOnStartup() {
89 LoadExtension(test_data_dir_.AppendASCII("good_unpacked"));
92 void ExtensionMessageBubbleBrowserTest::TestBubbleShowsOnStartup() {
93 base::RunLoop().RunUntilIdle();
94 CheckBubble(browser(), ANCHOR_BROWSER_ACTION);
95 CloseBubble(browser());