OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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/browser/ui/extensions/extension_message_bubble_browsertest.h" | 5 #include "chrome/browser/ui/extensions/extension_message_bubble_browsertest.h" |
6 | 6 |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 CloseBubble(second_browser); | 117 CloseBubble(second_browser); |
118 } | 118 } |
119 | 119 |
120 void ExtensionMessageBubbleBrowserTest::TestBubbleAnchoredToAppMenu() { | 120 void ExtensionMessageBubbleBrowserTest::TestBubbleAnchoredToAppMenu() { |
121 scoped_refptr<const extensions::Extension> no_action_extension = | 121 scoped_refptr<const extensions::Extension> no_action_extension = |
122 extensions::extension_action_test_util::CreateActionExtension( | 122 extensions::extension_action_test_util::CreateActionExtension( |
123 "no_action_extension", | 123 "no_action_extension", |
124 extensions::extension_action_test_util::NO_ACTION, | 124 extensions::extension_action_test_util::NO_ACTION, |
125 extensions::Manifest::UNPACKED); | 125 extensions::Manifest::UNPACKED); |
126 extension_service()->AddExtension(no_action_extension.get()); | 126 extension_service()->AddExtension(no_action_extension.get()); |
127 extension_service()->DisableExtension( | |
128 no_action_extension->id(), extensions::Extension::DISABLE_NOT_VERIFIED); | |
Finnur
2017/05/30 13:26:15
It is not immediately obvious why this (and below)
Devlin
2017/05/30 22:33:31
Good point! The reason is that, now that all exte
| |
127 Browser* second_browser = new Browser(Browser::CreateParams(profile(), true)); | 129 Browser* second_browser = new Browser(Browser::CreateParams(profile(), true)); |
128 ASSERT_TRUE(second_browser); | 130 ASSERT_TRUE(second_browser); |
129 second_browser->window()->Show(); | 131 second_browser->window()->Show(); |
130 base::RunLoop().RunUntilIdle(); | 132 base::RunLoop().RunUntilIdle(); |
131 CheckBubble(second_browser, ANCHOR_APP_MENU, false); | 133 CheckBubble(second_browser, ANCHOR_APP_MENU, false); |
132 CloseBubble(second_browser); | 134 CloseBubble(second_browser); |
133 } | 135 } |
134 | 136 |
135 void ExtensionMessageBubbleBrowserTest:: | 137 void ExtensionMessageBubbleBrowserTest:: |
136 TestBubbleAnchoredToAppMenuWithOtherAction() { | 138 TestBubbleAnchoredToAppMenuWithOtherAction() { |
137 scoped_refptr<const extensions::Extension> no_action_extension = | 139 scoped_refptr<const extensions::Extension> no_action_extension = |
138 extensions::extension_action_test_util::CreateActionExtension( | 140 extensions::extension_action_test_util::CreateActionExtension( |
139 "no_action_extension", | 141 "no_action_extension", |
140 extensions::extension_action_test_util::NO_ACTION, | 142 extensions::extension_action_test_util::NO_ACTION, |
141 extensions::Manifest::UNPACKED); | 143 extensions::Manifest::UNPACKED); |
142 extension_service()->AddExtension(no_action_extension.get()); | 144 extension_service()->AddExtension(no_action_extension.get()); |
143 | 145 |
144 scoped_refptr<const extensions::Extension> action_extension = | 146 scoped_refptr<const extensions::Extension> action_extension = |
145 extensions::extension_action_test_util::CreateActionExtension( | 147 extensions::extension_action_test_util::CreateActionExtension( |
146 "action_extension", | 148 "action_extension", |
147 extensions::extension_action_test_util::BROWSER_ACTION, | 149 extensions::extension_action_test_util::BROWSER_ACTION, |
148 extensions::Manifest::INTERNAL); | 150 extensions::Manifest::INTERNAL); |
149 extension_service()->AddExtension(action_extension.get()); | 151 extension_service()->AddExtension(action_extension.get()); |
150 | 152 |
153 extension_service()->DisableExtension( | |
154 no_action_extension->id(), extensions::Extension::DISABLE_NOT_VERIFIED); | |
155 | |
151 Browser* second_browser = new Browser(Browser::CreateParams(profile(), true)); | 156 Browser* second_browser = new Browser(Browser::CreateParams(profile(), true)); |
152 ASSERT_TRUE(second_browser); | 157 ASSERT_TRUE(second_browser); |
153 second_browser->window()->Show(); | 158 second_browser->window()->Show(); |
154 base::RunLoop().RunUntilIdle(); | 159 base::RunLoop().RunUntilIdle(); |
155 | 160 |
156 CheckBubble(second_browser, ANCHOR_APP_MENU, false); | 161 CheckBubble(second_browser, ANCHOR_APP_MENU, false); |
157 CloseBubble(second_browser); | 162 CloseBubble(second_browser); |
158 } | 163 } |
159 | 164 |
160 void ExtensionMessageBubbleBrowserTest::TestUninstallDangerousExtension() { | 165 void ExtensionMessageBubbleBrowserTest::TestUninstallDangerousExtension() { |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
378 second_browser->window()->Show(); | 383 second_browser->window()->Show(); |
379 base::RunLoop().RunUntilIdle(); | 384 base::RunLoop().RunUntilIdle(); |
380 CheckBubble(second_browser, ANCHOR_BROWSER_ACTION, true); | 385 CheckBubble(second_browser, ANCHOR_BROWSER_ACTION, true); |
381 ClickDismissButton(second_browser); | 386 ClickDismissButton(second_browser); |
382 base::RunLoop().RunUntilIdle(); | 387 base::RunLoop().RunUntilIdle(); |
383 CheckBubbleIsNotPresent(browser(), false, false); | 388 CheckBubbleIsNotPresent(browser(), false, false); |
384 // Clicking dismiss should have no affect, so the extension should still be | 389 // Clicking dismiss should have no affect, so the extension should still be |
385 // active. | 390 // active. |
386 EXPECT_TRUE(registry->enabled_extensions().GetByID(id)); | 391 EXPECT_TRUE(registry->enabled_extensions().GetByID(id)); |
387 } | 392 } |
OLD | NEW |