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" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // since good.crx has permissions that require approval. | 138 // since good.crx has permissions that require approval. |
139 ASSERT_TRUE(InstallExtension(test_data_dir_.AppendASCII("good.crx"), 0)); | 139 ASSERT_TRUE(InstallExtension(test_data_dir_.AppendASCII("good.crx"), 0)); |
140 UninstallExtension("ldnnhddmnhbkjipkidpdiheffobcpfmf"); | 140 UninstallExtension("ldnnhddmnhbkjipkidpdiheffobcpfmf"); |
141 | 141 |
142 // And the install should succeed when the permissions are accepted. | 142 // And the install should succeed when the permissions are accepted. |
143 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm( | 143 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm( |
144 test_data_dir_.AppendASCII("good.crx"), 1, browser()->profile())); | 144 test_data_dir_.AppendASCII("good.crx"), 1, browser()->profile())); |
145 UninstallExtension("ldnnhddmnhbkjipkidpdiheffobcpfmf"); | 145 UninstallExtension("ldnnhddmnhbkjipkidpdiheffobcpfmf"); |
146 } | 146 } |
147 | 147 |
148 // Tests that installing and uninstalling extensions don't crash with an | |
149 // incognito window open. | |
150 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, Incognito) { | |
151 // Open an incognito window to the extensions management page. We just | |
152 // want to make sure that we don't crash while playing with extensions when | |
153 // this guy is around. | |
154 ui_test_utils::OpenURLOffTheRecord(browser()->profile(), | |
155 GURL(chrome::kChromeUIExtensionsURL)); | |
156 | |
157 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm( | |
158 test_data_dir_.AppendASCII("good.crx"), 1, browser()->profile())); | |
159 UninstallExtension("ldnnhddmnhbkjipkidpdiheffobcpfmf"); | |
160 } | |
161 | |
162 // Tests the process of updating an extension to one that requires higher | 148 // Tests the process of updating an extension to one that requires higher |
163 // permissions. | 149 // permissions. |
164 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, UpdatePermissions) { | 150 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, UpdatePermissions) { |
165 ExtensionService* service = browser()->profile()->GetExtensionService(); | 151 ExtensionService* service = browser()->profile()->GetExtensionService(); |
166 ASSERT_TRUE(InstallAndUpdateIncreasingPermissionsExtension()); | 152 ASSERT_TRUE(InstallAndUpdateIncreasingPermissionsExtension()); |
167 const size_t size_before = service->extensions()->size(); | 153 const size_t size_before = service->extensions()->size(); |
168 | 154 |
169 // Now try reenabling it. | 155 // Now try reenabling it. |
170 service->EnableExtension(service->disabled_extensions()->at(0)->id()); | 156 service->EnableExtension(service->disabled_extensions()->at(0)->id()); |
171 EXPECT_EQ(size_before + 1, service->extensions()->size()); | 157 EXPECT_EQ(size_before + 1, service->extensions()->size()); |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 } | 600 } |
615 ASSERT_TRUE(WaitForExtensionInstall()); | 601 ASSERT_TRUE(WaitForExtensionInstall()); |
616 extensions = service->extensions(); | 602 extensions = service->extensions(); |
617 ASSERT_EQ(size_before + 1, extensions->size()); | 603 ASSERT_EQ(size_before + 1, extensions->size()); |
618 extension = extensions->at(size_before); | 604 extension = extensions->at(size_before); |
619 ASSERT_EQ(kExtensionId, extension->id()); | 605 ASSERT_EQ(kExtensionId, extension->id()); |
620 EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location()); | 606 EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location()); |
621 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); | 607 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); |
622 EXPECT_TRUE(service->disabled_extensions()->empty()); | 608 EXPECT_TRUE(service->disabled_extensions()->empty()); |
623 } | 609 } |
OLD | NEW |