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

Side by Side Diff: chrome/browser/extensions/extension_management_browsertest.cc

Issue 7810002: Move infobar handling to a tab helper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 9 years, 3 months 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 | Annotate | Revision Log
OLDNEW
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
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 InfoBarTabHelper* infobar_helper = browser()->GetTabContentsWrapperAt(0)->
181 ASSERT_EQ(1U, wrapper->infobar_count()); 182 infobar_tab_helper();
183 ASSERT_EQ(1U, infobar_helper->infobar_count());
182 184
183 // Uninstall, and check that the infobar went away. 185 // Uninstall, and check that the infobar went away.
184 ExtensionService* service = browser()->profile()->GetExtensionService(); 186 ExtensionService* service = browser()->profile()->GetExtensionService();
185 std::string id = service->disabled_extensions()->at(0)->id(); 187 std::string id = service->disabled_extensions()->at(0)->id();
186 UninstallExtension(id); 188 UninstallExtension(id);
187 ASSERT_EQ(0U, wrapper->infobar_count()); 189 ASSERT_EQ(0U, infobar_helper->infobar_count());
188 190
189 // Now select a new tab, and switch back to the first tab which had the 191 // Now select a new tab, and switch back to the first tab which had the
190 // infobar. We should not crash. 192 // infobar. We should not crash.
191 ASSERT_EQ(1, browser()->tab_count()); 193 ASSERT_EQ(1, browser()->tab_count());
192 ASSERT_EQ(0, browser()->active_index()); 194 ASSERT_EQ(0, browser()->active_index());
193 browser()->NewTab(); 195 browser()->NewTab();
194 ASSERT_EQ(2, browser()->tab_count()); 196 ASSERT_EQ(2, browser()->tab_count());
195 ASSERT_EQ(1, browser()->active_index()); 197 ASSERT_EQ(1, browser()->active_index());
196 browser()->ActivateTabAt(0, true); 198 browser()->ActivateTabAt(0, true);
197 } 199 }
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 } 614 }
613 ASSERT_TRUE(WaitForExtensionInstall()); 615 ASSERT_TRUE(WaitForExtensionInstall());
614 extensions = service->extensions(); 616 extensions = service->extensions();
615 ASSERT_EQ(size_before + 1, extensions->size()); 617 ASSERT_EQ(size_before + 1, extensions->size());
616 extension = extensions->at(size_before); 618 extension = extensions->at(size_before);
617 ASSERT_EQ(kExtensionId, extension->id()); 619 ASSERT_EQ(kExtensionId, extension->id());
618 EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location()); 620 EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location());
619 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); 621 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId));
620 EXPECT_TRUE(service->disabled_extensions()->empty()); 622 EXPECT_TRUE(service->disabled_extensions()->empty());
621 } 623 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_install_ui_browsertest.cc ('k') | chrome/browser/external_tab_container_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698