| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 CheckBubble(second_browser, ANCHOR_BROWSER_ACTION, true); | 116 CheckBubble(second_browser, ANCHOR_BROWSER_ACTION, true); |
| 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::INTERNAL); |
| 126 extension_service()->AddExtension(no_action_extension.get()); | 126 extension_service()->AddExtension(no_action_extension.get()); |
| 127 // The 'suspicious extension' bubble warns the user about extensions that are |
| 128 // disabled for not being from the webstore. This is one of the few bubbles |
| 129 // that lets us test anchoring to the app menu, since we usually anchor to the |
| 130 // extension action now that every extension is given a permanent UI presence. |
| 131 extension_service()->DisableExtension( |
| 132 no_action_extension->id(), extensions::Extension::DISABLE_NOT_VERIFIED); |
| 127 Browser* second_browser = new Browser(Browser::CreateParams(profile(), true)); | 133 Browser* second_browser = new Browser(Browser::CreateParams(profile(), true)); |
| 128 ASSERT_TRUE(second_browser); | 134 ASSERT_TRUE(second_browser); |
| 129 second_browser->window()->Show(); | 135 second_browser->window()->Show(); |
| 130 base::RunLoop().RunUntilIdle(); | 136 base::RunLoop().RunUntilIdle(); |
| 131 CheckBubble(second_browser, ANCHOR_APP_MENU, false); | 137 CheckBubble(second_browser, ANCHOR_APP_MENU, false); |
| 132 CloseBubble(second_browser); | 138 CloseBubble(second_browser); |
| 133 } | 139 } |
| 134 | 140 |
| 135 void ExtensionMessageBubbleBrowserTest:: | 141 void ExtensionMessageBubbleBrowserTest:: |
| 136 TestBubbleAnchoredToAppMenuWithOtherAction() { | 142 TestBubbleAnchoredToAppMenuWithOtherAction() { |
| 137 scoped_refptr<const extensions::Extension> no_action_extension = | 143 scoped_refptr<const extensions::Extension> no_action_extension = |
| 138 extensions::extension_action_test_util::CreateActionExtension( | 144 extensions::extension_action_test_util::CreateActionExtension( |
| 139 "no_action_extension", | 145 "no_action_extension", |
| 140 extensions::extension_action_test_util::NO_ACTION, | 146 extensions::extension_action_test_util::NO_ACTION, |
| 141 extensions::Manifest::UNPACKED); | 147 extensions::Manifest::INTERNAL); |
| 142 extension_service()->AddExtension(no_action_extension.get()); | 148 extension_service()->AddExtension(no_action_extension.get()); |
| 143 | 149 |
| 144 scoped_refptr<const extensions::Extension> action_extension = | 150 scoped_refptr<const extensions::Extension> action_extension = |
| 145 extensions::extension_action_test_util::CreateActionExtension( | 151 extensions::extension_action_test_util::CreateActionExtension( |
| 146 "action_extension", | 152 "action_extension", |
| 147 extensions::extension_action_test_util::BROWSER_ACTION, | 153 extensions::extension_action_test_util::BROWSER_ACTION, |
| 148 extensions::Manifest::INTERNAL); | 154 extensions::Manifest::INTERNAL); |
| 149 extension_service()->AddExtension(action_extension.get()); | 155 extension_service()->AddExtension(action_extension.get()); |
| 150 | 156 |
| 157 // The 'suspicious extension' bubble warns the user about extensions that are |
| 158 // disabled for not being from the webstore. This is one of the few bubbles |
| 159 // that lets us test anchoring to the app menu, since we usually anchor to the |
| 160 // extension action now that every extension is given a permanent UI presence. |
| 161 extension_service()->DisableExtension( |
| 162 no_action_extension->id(), extensions::Extension::DISABLE_NOT_VERIFIED); |
| 163 |
| 151 Browser* second_browser = new Browser(Browser::CreateParams(profile(), true)); | 164 Browser* second_browser = new Browser(Browser::CreateParams(profile(), true)); |
| 152 ASSERT_TRUE(second_browser); | 165 ASSERT_TRUE(second_browser); |
| 153 second_browser->window()->Show(); | 166 second_browser->window()->Show(); |
| 154 base::RunLoop().RunUntilIdle(); | 167 base::RunLoop().RunUntilIdle(); |
| 155 | 168 |
| 156 CheckBubble(second_browser, ANCHOR_APP_MENU, false); | 169 CheckBubble(second_browser, ANCHOR_APP_MENU, false); |
| 157 CloseBubble(second_browser); | 170 CloseBubble(second_browser); |
| 158 } | 171 } |
| 159 | 172 |
| 160 void ExtensionMessageBubbleBrowserTest::TestUninstallDangerousExtension() { | 173 void ExtensionMessageBubbleBrowserTest::TestUninstallDangerousExtension() { |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 second_browser->window()->Show(); | 391 second_browser->window()->Show(); |
| 379 base::RunLoop().RunUntilIdle(); | 392 base::RunLoop().RunUntilIdle(); |
| 380 CheckBubble(second_browser, ANCHOR_BROWSER_ACTION, true); | 393 CheckBubble(second_browser, ANCHOR_BROWSER_ACTION, true); |
| 381 ClickDismissButton(second_browser); | 394 ClickDismissButton(second_browser); |
| 382 base::RunLoop().RunUntilIdle(); | 395 base::RunLoop().RunUntilIdle(); |
| 383 CheckBubbleIsNotPresent(browser(), false, false); | 396 CheckBubbleIsNotPresent(browser(), false, false); |
| 384 // Clicking dismiss should have no affect, so the extension should still be | 397 // Clicking dismiss should have no affect, so the extension should still be |
| 385 // active. | 398 // active. |
| 386 EXPECT_TRUE(registry->enabled_extensions().GetByID(id)); | 399 EXPECT_TRUE(registry->enabled_extensions().GetByID(id)); |
| 387 } | 400 } |
| OLD | NEW |