OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
6 #include "base/stl_util.h" | 6 #include "base/stl_util.h" |
7 #include "chrome/browser/extensions/autoupdate_interceptor.h" | 7 #include "chrome/browser/extensions/autoupdate_interceptor.h" |
8 #include "chrome/browser/extensions/extension_browsertest.h" | 8 #include "chrome/browser/extensions/extension_browsertest.h" |
9 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/extensions/extension_test_message_listener.h" | 11 #include "chrome/browser/extensions/extension_test_message_listener.h" |
12 #include "chrome/browser/extensions/extension_updater.h" | 12 #include "chrome/browser/extensions/extension_updater.h" |
13 #include "chrome/browser/infobars/infobar_tab_helper.h" | |
13 #include "chrome/browser/prefs/pref_service.h" | 14 #include "chrome/browser/prefs/pref_service.h" |
14 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 15 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
18 #include "chrome/common/chrome_notification_types.h" | 19 #include "chrome/common/chrome_notification_types.h" |
19 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
20 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
21 #include "chrome/test/base/ui_test_utils.h" | 22 #include "chrome/test/base/ui_test_utils.h" |
22 #include "content/browser/renderer_host/render_view_host.h" | 23 #include "content/browser/renderer_host/render_view_host.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 EXPECT_EQ(size_before + 1, service->extensions()->size()); | 171 EXPECT_EQ(size_before + 1, service->extensions()->size()); |
171 EXPECT_EQ(0u, service->disabled_extensions()->size()); | 172 EXPECT_EQ(0u, service->disabled_extensions()->size()); |
172 } | 173 } |
173 | 174 |
174 // Tests uninstalling an extension that was disabled due to higher permissions. | 175 // Tests uninstalling an extension that was disabled due to higher permissions. |
175 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, UpdatePermissionsAndUninstall) { | 176 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, UpdatePermissionsAndUninstall) { |
176 ASSERT_TRUE(InstallAndUpdateIncreasingPermissionsExtension()); | 177 ASSERT_TRUE(InstallAndUpdateIncreasingPermissionsExtension()); |
177 | 178 |
178 // Make sure the "disable extension" infobar is present. | 179 // Make sure the "disable extension" infobar is present. |
179 ASSERT_EQ(0, browser()->active_index()); | 180 ASSERT_EQ(0, browser()->active_index()); |
180 TabContentsWrapper* wrapper = browser()->GetTabContentsWrapperAt(0); | 181 TabContentsWrapper* wrapper = browser()->GetTabContentsWrapperAt(0); |
Peter Kasting
2011/08/31 18:47:32
Nit: Convert this TCW* temp into an InfoBarTabHelp
| |
181 ASSERT_EQ(1U, wrapper->infobar_count()); | 182 ASSERT_EQ(1U, wrapper->infobar_tab_helper()->infobar_count()); |
182 | 183 |
183 // Uninstall, and check that the infobar went away. | 184 // Uninstall, and check that the infobar went away. |
184 ExtensionService* service = browser()->profile()->GetExtensionService(); | 185 ExtensionService* service = browser()->profile()->GetExtensionService(); |
185 std::string id = service->disabled_extensions()->at(0)->id(); | 186 std::string id = service->disabled_extensions()->at(0)->id(); |
186 UninstallExtension(id); | 187 UninstallExtension(id); |
187 ASSERT_EQ(0U, wrapper->infobar_count()); | 188 ASSERT_EQ(0U, wrapper->infobar_tab_helper()->infobar_count()); |
188 | 189 |
189 // Now select a new tab, and switch back to the first tab which had the | 190 // Now select a new tab, and switch back to the first tab which had the |
190 // infobar. We should not crash. | 191 // infobar. We should not crash. |
191 ASSERT_EQ(1, browser()->tab_count()); | 192 ASSERT_EQ(1, browser()->tab_count()); |
192 ASSERT_EQ(0, browser()->active_index()); | 193 ASSERT_EQ(0, browser()->active_index()); |
193 browser()->NewTab(); | 194 browser()->NewTab(); |
194 ASSERT_EQ(2, browser()->tab_count()); | 195 ASSERT_EQ(2, browser()->tab_count()); |
195 ASSERT_EQ(1, browser()->active_index()); | 196 ASSERT_EQ(1, browser()->active_index()); |
196 browser()->ActivateTabAt(0, true); | 197 browser()->ActivateTabAt(0, true); |
197 } | 198 } |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
612 } | 613 } |
613 ASSERT_TRUE(WaitForExtensionInstall()); | 614 ASSERT_TRUE(WaitForExtensionInstall()); |
614 extensions = service->extensions(); | 615 extensions = service->extensions(); |
615 ASSERT_EQ(size_before + 1, extensions->size()); | 616 ASSERT_EQ(size_before + 1, extensions->size()); |
616 extension = extensions->at(size_before); | 617 extension = extensions->at(size_before); |
617 ASSERT_EQ(kExtensionId, extension->id()); | 618 ASSERT_EQ(kExtensionId, extension->id()); |
618 EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location()); | 619 EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location()); |
619 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); | 620 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); |
620 EXPECT_TRUE(service->disabled_extensions()->empty()); | 621 EXPECT_TRUE(service->disabled_extensions()->empty()); |
621 } | 622 } |
OLD | NEW |