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

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

Issue 2431313003: Mojofy unittests related to service workers (Closed)
Patch Set: Rebase Created 4 years, 2 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
Index: content/browser/service_worker/service_worker_registration_unittest.cc
diff --git a/content/browser/service_worker/service_worker_registration_unittest.cc b/content/browser/service_worker/service_worker_registration_unittest.cc
index 494240c3febc826699ea477af0be4df1380ced88..e06387b3f76d0851ff701227aeb8088b9ae5cb73 100644
--- a/content/browser/service_worker/service_worker_registration_unittest.cc
+++ b/content/browser/service_worker/service_worker_registration_unittest.cc
@@ -99,7 +99,10 @@ class ServiceWorkerRegistrationTest : public testing::Test {
TestBrowserThreadBundle thread_bundle_;
};
-TEST_F(ServiceWorkerRegistrationTest, SetAndUnsetVersions) {
+class ServiceWorkerRegistrationTestP
+ : public MojoServiceWorkerTestP<ServiceWorkerRegistrationTest> {};
+
+TEST_P(ServiceWorkerRegistrationTestP, SetAndUnsetVersions) {
const GURL kScope("http://www.example.not/");
const GURL kScript("http://www.example.not/service_worker.js");
int64_t kRegistrationId = 1L;
@@ -167,7 +170,7 @@ TEST_F(ServiceWorkerRegistrationTest, SetAndUnsetVersions) {
kInvalidServiceWorkerVersionId);
}
-TEST_F(ServiceWorkerRegistrationTest, FailedRegistrationNoCrash) {
+TEST_P(ServiceWorkerRegistrationTestP, FailedRegistrationNoCrash) {
const GURL kScope("http://www.example.not/");
int64_t kRegistrationId = 1L;
scoped_refptr<ServiceWorkerRegistration> registration =
@@ -183,9 +186,9 @@ TEST_F(ServiceWorkerRegistrationTest, FailedRegistrationNoCrash) {
// Sets up a registration with a waiting worker, and an active worker
// with a controllee and an inflight request.
-class ServiceWorkerActivationTest : public ServiceWorkerRegistrationTest {
+class ServiceWorkerActivationTest : public ServiceWorkerRegistrationTestP {
public:
- ServiceWorkerActivationTest() : ServiceWorkerRegistrationTest() {}
+ ServiceWorkerActivationTest() : ServiceWorkerRegistrationTestP() {}
void SetUp() override {
ServiceWorkerRegistrationTest::SetUp();
@@ -261,7 +264,7 @@ class ServiceWorkerActivationTest : public ServiceWorkerRegistrationTest {
};
// Test activation triggered by finishing all requests.
-TEST_F(ServiceWorkerActivationTest, NoInflightRequest) {
+TEST_P(ServiceWorkerActivationTest, NoInflightRequest) {
scoped_refptr<ServiceWorkerRegistration> reg = registration();
scoped_refptr<ServiceWorkerVersion> version_1 = reg->active_version();
scoped_refptr<ServiceWorkerVersion> version_2 = reg->waiting_version();
@@ -280,7 +283,7 @@ TEST_F(ServiceWorkerActivationTest, NoInflightRequest) {
}
// Test activation triggered by loss of controllee.
-TEST_F(ServiceWorkerActivationTest, NoControllee) {
+TEST_P(ServiceWorkerActivationTest, NoControllee) {
scoped_refptr<ServiceWorkerRegistration> reg = registration();
scoped_refptr<ServiceWorkerVersion> version_1 = reg->active_version();
scoped_refptr<ServiceWorkerVersion> version_2 = reg->waiting_version();
@@ -299,7 +302,7 @@ TEST_F(ServiceWorkerActivationTest, NoControllee) {
}
// Test activation triggered by skipWaiting.
-TEST_F(ServiceWorkerActivationTest, SkipWaiting) {
+TEST_P(ServiceWorkerActivationTest, SkipWaiting) {
scoped_refptr<ServiceWorkerRegistration> reg = registration();
scoped_refptr<ServiceWorkerVersion> version_1 = reg->active_version();
scoped_refptr<ServiceWorkerVersion> version_2 = reg->waiting_version();
@@ -318,7 +321,7 @@ TEST_F(ServiceWorkerActivationTest, SkipWaiting) {
}
// Test activation triggered by skipWaiting and finishing requests.
-TEST_F(ServiceWorkerActivationTest, SkipWaitingWithInflightRequest) {
+TEST_P(ServiceWorkerActivationTest, SkipWaitingWithInflightRequest) {
scoped_refptr<ServiceWorkerRegistration> reg = registration();
scoped_refptr<ServiceWorkerVersion> version_1 = reg->active_version();
scoped_refptr<ServiceWorkerVersion> version_2 = reg->waiting_version();
@@ -336,4 +339,12 @@ TEST_F(ServiceWorkerActivationTest, SkipWaitingWithInflightRequest) {
EXPECT_EQ(version_2.get(), reg->active_version());
}
+INSTANTIATE_TEST_CASE_P(ServiceWorkerRegistrationTest,
+ ServiceWorkerRegistrationTestP,
+ testing::Bool());
+
+INSTANTIATE_TEST_CASE_P(ServiceWorkerActivationTest,
+ ServiceWorkerActivationTest,
+ testing::Bool());
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698