diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-04 22:04:19 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-04 22:04:19 +0000 |
commit | a7552342506985bc90b33ab54cb62df1bfb190a6 (patch) | |
tree | 3b961ba167604c1d4276d9847be9e7ff1c135b1b /chrome | |
parent | b305895514a6affd4ba076d5655fe86eb71be9cc (diff) | |
download | chromium_src-a7552342506985bc90b33ab54cb62df1bfb190a6.zip chromium_src-a7552342506985bc90b33ab54cb62df1bfb190a6.tar.gz chromium_src-a7552342506985bc90b33ab54cb62df1bfb190a6.tar.bz2 |
Add the test for the AllUrls Extension feature.
The test was failing on the bots because the extensions get different ids
on different bots, since the paths are different. I've changed the test to
load the extensions first and then query their id, instead of relying on
the id they get on my computer.
BUG=36275
TEST=AllUrlsApiTest (2 new ones)
Review URL: http://codereview.chromium.org/3610006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61419 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/extensions/all_urls_apitest.cc | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/chrome/browser/extensions/all_urls_apitest.cc b/chrome/browser/extensions/all_urls_apitest.cc index 2ab8a9b..016d4f2 100644 --- a/chrome/browser/extensions/all_urls_apitest.cc +++ b/chrome/browser/extensions/all_urls_apitest.cc @@ -15,17 +15,8 @@ const std::string kAllUrlsTarget = typedef ExtensionApiTest AllUrlsApiTest; -IN_PROC_BROWSER_TEST_F(AllUrlsApiTest, FAILS_WhitelistedExtension) { - // First add the two extensions we are going to load to the whitelist. - const char* kCanExecuteScriptsEverywhere[] = { - "fekpfaahmgnelcjpkefdnpiofglcgmgo", - "bpkfbiacjfimfmglhncgmibnddpnhmoj", - }; - Extension::SetScriptingWhitelist(kCanExecuteScriptsEverywhere, - arraysize(kCanExecuteScriptsEverywhere)); - - - // Then load the two extension. +IN_PROC_BROWSER_TEST_F(AllUrlsApiTest, WhitelistedExtension) { + // First load the two extension. FilePath extension_dir1 = test_data_dir_.AppendASCII("all_urls") .AppendASCII("content_script"); FilePath extension_dir2 = test_data_dir_.AppendASCII("all_urls") @@ -36,6 +27,22 @@ IN_PROC_BROWSER_TEST_F(AllUrlsApiTest, FAILS_WhitelistedExtension) { ASSERT_TRUE(LoadExtension(extension_dir1)); ASSERT_TRUE(LoadExtension(extension_dir2)); EXPECT_EQ(size_before + 2, service->extensions()->size()); + Extension* extensionA = service->extensions()->at(size_before); + Extension* extensionB = service->extensions()->at(size_before + 1); + + // Then add the two extensions to the whitelist. + const char* kCanExecuteScriptsEverywhere[] = { + extensionA->id().c_str(), + extensionB->id().c_str(), + }; + Extension::SetScriptingWhitelist(kCanExecuteScriptsEverywhere, + arraysize(kCanExecuteScriptsEverywhere)); + + // Ideally, we'd set the whitelist first and then load the extensions. + // However, we can't reliably know the ids of the extensions until we load + // them so we reload them so that the whitelist is in effect from the start. + ReloadExtension(extensionA->id()); + ReloadExtension(extensionB->id()); std::string url; |