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

Unified Diff: content/browser/service_worker/service_worker_browsertest.cc

Issue 153553008: Wire InstallFinished and add some InstallEvent.waitUntil tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/renderer/service_worker/embedded_worker_context_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_browsertest.cc
diff --git a/content/browser/service_worker/service_worker_browsertest.cc b/content/browser/service_worker/service_worker_browsertest.cc
index 1b64818a7cf91ff2eab0069bb8249f198780ebf1..81f329693da82b7d60e2d2fc8ddb575f8e240f87 100644
--- a/content/browser/service_worker/service_worker_browsertest.cc
+++ b/content/browser/service_worker/service_worker_browsertest.cc
@@ -194,6 +194,31 @@ class ServiceWorkerVersionBrowserTest : public ServiceWorkerBrowserTest {
}
}
+ void InstallTestHelper(const std::string& worker_url) {
+ RunOnIOThread(base::Bind(&self::SetUpRegistrationOnIOThread, this,
+ worker_url));
+
+ // Dispatch install on a worker.
+ ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED;
+ base::RunLoop install_run_loop;
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
+ base::Bind(&self::InstallOnIOThread, this,
+ install_run_loop.QuitClosure(),
+ &status));
+ install_run_loop.Run();
+ ASSERT_EQ(SERVICE_WORKER_OK, status);
+
+ // Stop the worker.
+ status = SERVICE_WORKER_ERROR_FAILED;
+ base::RunLoop stop_run_loop;
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
+ base::Bind(&self::StopOnIOThread, this,
+ stop_run_loop.QuitClosure(),
+ &status));
+ stop_run_loop.Run();
+ ASSERT_EQ(SERVICE_WORKER_OK, status);
+ }
+
void SetUpRegistrationOnIOThread(const std::string& worker_url) {
const int64 version_id = 1L;
registration_ = new ServiceWorkerRegistration(
@@ -293,28 +318,19 @@ IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest, StartNotFound) {
}
IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest, Install) {
- RunOnIOThread(base::Bind(&self::SetUpRegistrationOnIOThread, this,
- "/service_worker/worker.js"));
+ InstallTestHelper("/service_worker/worker.js");
+}
- // Dispatch install on a worker.
- ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED;
- base::RunLoop install_run_loop;
- BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
- base::Bind(&self::InstallOnIOThread, this,
- install_run_loop.QuitClosure(),
- &status));
- install_run_loop.Run();
- ASSERT_EQ(SERVICE_WORKER_OK, status);
+IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest,
+ InstallWithWaitUntil_Fulfilled) {
+ InstallTestHelper("/service_worker/worker_install_fulfilled.js");
+}
- // Stop the worker.
- status = SERVICE_WORKER_ERROR_FAILED;
- base::RunLoop stop_run_loop;
- BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
- base::Bind(&self::StopOnIOThread, this,
- stop_run_loop.QuitClosure(),
- &status));
- stop_run_loop.Run();
- ASSERT_EQ(SERVICE_WORKER_OK, status);
+IN_PROC_BROWSER_TEST_F(ServiceWorkerVersionBrowserTest,
+ InstallWithWaitUntil_Rejected) {
+ // TODO(kinuko): This should also report back an error, but we
+ // don't have plumbing for it yet.
+ InstallTestHelper("/service_worker/worker_install_rejected.js");
}
} // namespace content
« no previous file with comments | « no previous file | content/renderer/service_worker/embedded_worker_context_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698