summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extensions_service_unittest.cc
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-25 01:06:42 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-25 01:06:42 +0000
commit494c06ed7762ad06d70d83ce2c3c459944b3dfcd (patch)
treea88cfc109eb6d1b06258987e7f37432baea399ba /chrome/browser/extensions/extensions_service_unittest.cc
parent97b3aef453bcfa1771bebcd68d8bc76a6c113826 (diff)
downloadchromium_src-494c06ed7762ad06d70d83ce2c3c459944b3dfcd.zip
chromium_src-494c06ed7762ad06d70d83ce2c3c459944b3dfcd.tar.gz
chromium_src-494c06ed7762ad06d70d83ce2c3c459944b3dfcd.tar.bz2
Use referrer_url instead of download url to decide whether a
theme installation can happens sans-prompt. Review URL: http://codereview.chromium.org/160087 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21603 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extensions_service_unittest.cc')
-rw-r--r--chrome/browser/extensions/extensions_service_unittest.cc24
1 files changed, 19 insertions, 5 deletions
diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc
index cdb4d18..57799fa 100644
--- a/chrome/browser/extensions/extensions_service_unittest.cc
+++ b/chrome/browser/extensions/extensions_service_unittest.cc
@@ -342,14 +342,15 @@ class ExtensionsServiceTest
void InstallExtension(const FilePath& path,
bool should_succeed) {
- InstallExtension(path, should_succeed, GURL());
+ InstallExtension(path, should_succeed, GURL(), GURL());
}
void InstallExtension(const FilePath& path,
bool should_succeed,
+ const GURL& download_url,
const GURL& referrer_url) {
ASSERT_TRUE(file_util::PathExists(path));
- service_->InstallExtension(path, referrer_url);
+ service_->InstallExtension(path, download_url, referrer_url);
loop_.RunAllPending();
std::vector<std::string> errors = GetErrors();
if (should_succeed) {
@@ -809,15 +810,28 @@ TEST_F(ExtensionsServiceTest, InstallTheme) {
// ... unless they come from the gallery URL.
SetExtensionsEnabled(false);
path = extensions_path.AppendASCII("theme2.crx");
- InstallExtension(path, true, GURL(
- std::string(ExtensionsService::kGalleryURLPrefix) + "foobar"));
+ InstallExtension(path, true,
+ GURL(std::string(ExtensionsService::kGalleryDownloadURLPrefix) + "f.crx"),
+ GURL(std::string(ExtensionsService::kGalleryURLPrefix) + "foobar"));
ValidatePrefKeyCount(++pref_count);
ValidatePref(theme2_crx, L"state", Extension::ENABLED);
ValidatePref(theme2_crx, L"location", Extension::INTERNAL);
- SetExtensionsEnabled(true);
+
+ // also test this fails if either of the URLs is not correct
+ path = extensions_path.AppendASCII("theme2.crx");
+ InstallExtension(path, false,
+ GURL(std::string(ExtensionsService::kGalleryDownloadURLPrefix) + "f.crx"),
+ GURL());
+ ValidatePrefKeyCount(pref_count);
+
+ path = extensions_path.AppendASCII("theme2.crx");
+ InstallExtension(path, false,
+ GURL(), GURL(std::string(ExtensionsService::kGalleryURLPrefix) + "foobar"));
+ ValidatePrefKeyCount(pref_count);
// A theme with extension elements. Themes cannot have extension elements so
// this test should fail.
+ SetExtensionsEnabled(true);
path = extensions_path.AppendASCII("theme_with_extension.crx");
InstallExtension(path, false);
ValidatePrefKeyCount(pref_count);