Index: content/browser/service_worker/service_worker_job_unittest.cc |
diff --git a/content/browser/service_worker/service_worker_job_unittest.cc b/content/browser/service_worker/service_worker_job_unittest.cc |
index e08896072a05b74a8551b0d0da88a467c99082b7..5db416d7393730f713b1f14c0091e96023c796db 100644 |
--- a/content/browser/service_worker/service_worker_job_unittest.cc |
+++ b/content/browser/service_worker/service_worker_job_unittest.cc |
@@ -360,7 +360,7 @@ class FailToStartWorkerTestHelper : public EmbeddedWorkerTestHelper { |
: EmbeddedWorkerTestHelper(base::FilePath(), mock_render_process_id) {} |
void OnStartWorker(int embedded_worker_id, |
- int64 service_worker_version_id, |
+ std::string service_worker_version_uuid, |
const GURL& scope, |
const GURL& script_url, |
bool pause_after_download) override { |
@@ -641,7 +641,9 @@ TEST_F(ServiceWorkerJobTest, UnregisterWaitingSetsRedundant) { |
// Manually create the waiting worker since there is no way to become a |
// waiting worker until Update is implemented. |
scoped_refptr<ServiceWorkerVersion> version = new ServiceWorkerVersion( |
- registration.get(), script_url, 1L, helper_->context()->AsWeakPtr()); |
+ registration.get(), script_url, |
+ std::string("2939b50b-fc8d-46ad-86e4-b4295b8fbc86"), |
+ helper_->context()->AsWeakPtr()); |
ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; |
version->StartWorker(CreateReceiverOnCurrentThread(&status)); |
base::RunLoop().RunUntilIdle(); |
@@ -776,7 +778,7 @@ class UpdateJobTestHelper |
}; |
struct StateChangeLogEntry { |
- int64 version_id; |
+ std::string version_uuid; |
ServiceWorkerVersion::Status status; |
}; |
@@ -814,13 +816,13 @@ class UpdateJobTestHelper |
// EmbeddedWorkerTestHelper overrides |
void OnStartWorker(int embedded_worker_id, |
- int64 version_id, |
+ std::string version_uuid, |
const GURL& scope, |
const GURL& script, |
bool pause_after_download) override { |
const std::string kMockScriptBody = "mock_script"; |
const uint64 kMockScriptSize = 19284; |
- ServiceWorkerVersion* version = context()->GetLiveVersion(version_id); |
+ ServiceWorkerVersion* version = context()->GetLiveVersion(version_uuid); |
ASSERT_TRUE(version); |
version->AddListener(this); |
@@ -843,7 +845,7 @@ class UpdateJobTestHelper |
script, kMockScriptSize, net::URLRequestStatus(), std::string()); |
} |
EmbeddedWorkerTestHelper::OnStartWorker( |
- embedded_worker_id, version_id, scope, script, pause_after_download); |
+ embedded_worker_id, version_uuid, scope, script, pause_after_download); |
} |
// ServiceWorkerRegistration::Listener overrides |
@@ -870,7 +872,7 @@ class UpdateJobTestHelper |
// ServiceWorkerVersion::Listener overrides |
void OnVersionStateChanged(ServiceWorkerVersion* version) override { |
StateChangeLogEntry entry; |
- entry.version_id = version->version_id(); |
+ entry.version_uuid = version->version_uuid(); |
entry.status = version->status(); |
state_change_log_.push_back(entry); |
} |
@@ -891,13 +893,13 @@ class EvictIncumbentVersionHelper : public UpdateJobTestHelper { |
~EvictIncumbentVersionHelper() override {} |
void OnStartWorker(int embedded_worker_id, |
- int64 version_id, |
+ std::string version_uuid, |
const GURL& scope, |
const GURL& script, |
bool pause_after_download) override { |
if (pause_after_download) { |
// Evict the incumbent worker. |
- ServiceWorkerVersion* version = context()->GetLiveVersion(version_id); |
+ ServiceWorkerVersion* version = context()->GetLiveVersion(version_uuid); |
ASSERT_TRUE(version); |
ServiceWorkerRegistration* registration = |
context()->GetLiveRegistration(version->registration_id()); |
@@ -907,7 +909,7 @@ class EvictIncumbentVersionHelper : public UpdateJobTestHelper { |
registration->DeleteVersion( |
make_scoped_refptr(registration->active_version())); |
} |
- UpdateJobTestHelper::OnStartWorker(embedded_worker_id, version_id, scope, |
+ UpdateJobTestHelper::OnStartWorker(embedded_worker_id, version_uuid, scope, |
script, pause_after_download); |
} |
@@ -952,8 +954,8 @@ TEST_F(ServiceWorkerJobTest, Update_NoChange) { |
EXPECT_FALSE(registration->waiting_version()); |
EXPECT_TRUE(update_helper->attribute_change_log_.empty()); |
ASSERT_EQ(1u, update_helper->state_change_log_.size()); |
- EXPECT_NE(registration->active_version()->version_id(), |
- update_helper->state_change_log_[0].version_id); |
+ EXPECT_NE(registration->active_version()->version_uuid(), |
+ update_helper->state_change_log_[0].version_uuid); |
EXPECT_EQ(ServiceWorkerVersion::REDUNDANT, |
update_helper->state_change_log_[0].status); |
EXPECT_FALSE(update_helper->update_found_); |
@@ -987,34 +989,25 @@ TEST_F(ServiceWorkerJobTest, Update_NewVersion) { |
EXPECT_TRUE(entry.mask.installing_changed()); |
EXPECT_FALSE(entry.mask.waiting_changed()); |
EXPECT_FALSE(entry.mask.active_changed()); |
- EXPECT_NE(entry.info.installing_version.version_id, |
- kInvalidServiceWorkerVersionId); |
- EXPECT_EQ(entry.info.waiting_version.version_id, |
- kInvalidServiceWorkerVersionId); |
- EXPECT_NE(entry.info.active_version.version_id, |
- kInvalidServiceWorkerVersionId); |
+ EXPECT_FALSE(entry.info.installing_version.version_uuid.empty()); |
+ EXPECT_TRUE(entry.info.waiting_version.version_uuid.empty()); |
+ EXPECT_FALSE(entry.info.active_version.version_uuid.empty()); |
entry = update_helper->attribute_change_log_[1]; |
EXPECT_TRUE(entry.mask.installing_changed()); |
EXPECT_TRUE(entry.mask.waiting_changed()); |
EXPECT_FALSE(entry.mask.active_changed()); |
- EXPECT_EQ(entry.info.installing_version.version_id, |
- kInvalidServiceWorkerVersionId); |
- EXPECT_NE(entry.info.waiting_version.version_id, |
- kInvalidServiceWorkerVersionId); |
- EXPECT_NE(entry.info.active_version.version_id, |
- kInvalidServiceWorkerVersionId); |
+ EXPECT_TRUE(entry.info.installing_version.version_uuid.empty()); |
+ EXPECT_FALSE(entry.info.waiting_version.version_uuid.empty()); |
+ EXPECT_FALSE(entry.info.active_version.version_uuid.empty()); |
entry = update_helper->attribute_change_log_[2]; |
EXPECT_FALSE(entry.mask.installing_changed()); |
EXPECT_TRUE(entry.mask.waiting_changed()); |
EXPECT_TRUE(entry.mask.active_changed()); |
- EXPECT_EQ(entry.info.installing_version.version_id, |
- kInvalidServiceWorkerVersionId); |
- EXPECT_EQ(entry.info.waiting_version.version_id, |
- kInvalidServiceWorkerVersionId); |
- EXPECT_NE(entry.info.active_version.version_id, |
- kInvalidServiceWorkerVersionId); |
+ EXPECT_TRUE(entry.info.installing_version.version_uuid.empty()); |
+ EXPECT_TRUE(entry.info.waiting_version.version_uuid.empty()); |
+ EXPECT_FALSE(entry.info.active_version.version_uuid.empty()); |
// expected version state transitions: |
// new.installing, new.installed, |
@@ -1022,28 +1015,28 @@ TEST_F(ServiceWorkerJobTest, Update_NewVersion) { |
// new.activating, new.activated |
ASSERT_EQ(5u, update_helper->state_change_log_.size()); |
- EXPECT_EQ(registration->active_version()->version_id(), |
- update_helper->state_change_log_[0].version_id); |
+ EXPECT_EQ(registration->active_version()->version_uuid(), |
+ update_helper->state_change_log_[0].version_uuid); |
EXPECT_EQ(ServiceWorkerVersion::INSTALLING, |
update_helper->state_change_log_[0].status); |
- EXPECT_EQ(registration->active_version()->version_id(), |
- update_helper->state_change_log_[1].version_id); |
+ EXPECT_EQ(registration->active_version()->version_uuid(), |
+ update_helper->state_change_log_[1].version_uuid); |
EXPECT_EQ(ServiceWorkerVersion::INSTALLED, |
update_helper->state_change_log_[1].status); |
- EXPECT_EQ(first_version->version_id(), |
- update_helper->state_change_log_[2].version_id); |
+ EXPECT_EQ(first_version->version_uuid(), |
+ update_helper->state_change_log_[2].version_uuid); |
EXPECT_EQ(ServiceWorkerVersion::REDUNDANT, |
update_helper->state_change_log_[2].status); |
- EXPECT_EQ(registration->active_version()->version_id(), |
- update_helper->state_change_log_[3].version_id); |
+ EXPECT_EQ(registration->active_version()->version_uuid(), |
+ update_helper->state_change_log_[3].version_uuid); |
EXPECT_EQ(ServiceWorkerVersion::ACTIVATING, |
update_helper->state_change_log_[3].status); |
- EXPECT_EQ(registration->active_version()->version_id(), |
- update_helper->state_change_log_[4].version_id); |
+ EXPECT_EQ(registration->active_version()->version_uuid(), |
+ update_helper->state_change_log_[4].version_uuid); |
EXPECT_EQ(ServiceWorkerVersion::ACTIVATED, |
update_helper->state_change_log_[4].status); |
@@ -1061,11 +1054,11 @@ TEST_F(ServiceWorkerJobTest, Update_NewestVersionChanged) { |
job_coordinator()->Update(registration.get(), false); |
// Add a waiting version with new script. |
- scoped_refptr<ServiceWorkerVersion> version = |
- new ServiceWorkerVersion(registration.get(), |
- GURL("http://www.example.com/new_worker.js"), |
- 2L /* dummy version id */, |
- helper_->context()->AsWeakPtr()); |
+ scoped_refptr<ServiceWorkerVersion> version = new ServiceWorkerVersion( |
+ registration.get(), GURL("http://www.example.com/new_worker.js"), |
+ std::string( |
+ "03fdbf6e-61b6-476a-9379-11d172ade44b") /* dummy version id */, |
+ helper_->context()->AsWeakPtr()); |
registration->SetWaitingVersion(version); |
base::RunLoop().RunUntilIdle(); |