Index: chrome/browser/extensions/service_worker_apitest.cc |
diff --git a/chrome/browser/extensions/service_worker_apitest.cc b/chrome/browser/extensions/service_worker_apitest.cc |
index 29fad8fa5aa7285fc66d58454b3be8d38db67766..aa9d25f7ecf8617597a9ae8b1a359c666d8b6a7f 100644 |
--- a/chrome/browser/extensions/service_worker_apitest.cc |
+++ b/chrome/browser/extensions/service_worker_apitest.cc |
@@ -132,6 +132,41 @@ IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, RegisterFailsOnDev) { |
error); |
} |
+IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, UpdateRefreshesServiceWorker) { |
+ base::ScopedTempDir scoped_temp_dir; |
+ ASSERT_TRUE(scoped_temp_dir.CreateUniqueTempDir()); |
+ base::FilePath pem_path = test_data_dir_. AppendASCII("service_worker") |
+ .AppendASCII("update").AppendASCII("service_worker.pem"); |
+ base::FilePath path_v1 = PackExtensionWithOptions( |
+ test_data_dir_.AppendASCII("service_worker").AppendASCII("update") |
+ .AppendASCII("v1"), |
+ scoped_temp_dir.path().AppendASCII("v1.crx"), |
+ pem_path, base::FilePath()); |
+ base::FilePath path_v2 = PackExtensionWithOptions( |
+ test_data_dir_.AppendASCII("service_worker").AppendASCII("update") |
+ .AppendASCII("v2"), |
+ scoped_temp_dir.path().AppendASCII("v2.crx"), |
+ pem_path, base::FilePath()); |
+ |
+ ExtensionService* service = ExtensionSystem::Get(browser()->profile())-> |
+ extension_service(); |
+ const char kId[] = "hfaanndiiilofhfokeanhddpkfffchdi"; |
+ |
+ // Install version 1.0 of the extension. |
+ ASSERT_TRUE(InstallExtension(path_v1, 1)); |
+ EXPECT_TRUE(service->GetExtensionById(kId, false) != NULL); |
+ |
+ const char* kScript = "window.testResolver();"; |
+ EXPECT_EQ("true", ExecuteScriptInBackgroundPage(kId, kScript)); |
+ |
+ // Update to version 2.0. |
+ EXPECT_TRUE(UpdateExtension(kId, path_v2, 0)); |
+ EXPECT_TRUE(service->GetExtensionById(kId, false) != NULL); |
+ |
+ EXPECT_EQ("true", ExecuteScriptInBackgroundPage(kId, kScript)); |
+} |
+ |
+ |
IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, FetchArbitraryPaths) { |
const Extension* extension = |
StartTestFromBackgroundPage("fetch.js", kExpectSuccess); |