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

Side by Side Diff: content/browser/service_worker/service_worker_job_unittest.cc

Issue 691413002: Removing redundant 'is_null' field in ServiceWorkerVersionInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/files/scoped_temp_dir.h" 5 #include "base/files/scoped_temp_dir.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "content/browser/browser_thread_impl.h" 8 #include "content/browser/browser_thread_impl.h"
9 #include "content/browser/service_worker/embedded_worker_registry.h" 9 #include "content/browser/service_worker/embedded_worker_registry.h"
10 #include "content/browser/service_worker/embedded_worker_test_helper.h" 10 #include "content/browser/service_worker/embedded_worker_test_helper.h"
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 EXPECT_NE(first_version.get(), registration->active_version()); 1061 EXPECT_NE(first_version.get(), registration->active_version());
1062 EXPECT_FALSE(registration->installing_version()); 1062 EXPECT_FALSE(registration->installing_version());
1063 EXPECT_FALSE(registration->waiting_version()); 1063 EXPECT_FALSE(registration->waiting_version());
1064 ASSERT_EQ(3u, update_helper->attribute_change_log_.size()); 1064 ASSERT_EQ(3u, update_helper->attribute_change_log_.size());
1065 1065
1066 UpdateJobTestHelper::AttributeChangeLogEntry entry; 1066 UpdateJobTestHelper::AttributeChangeLogEntry entry;
1067 entry = update_helper->attribute_change_log_[0]; 1067 entry = update_helper->attribute_change_log_[0];
1068 EXPECT_TRUE(entry.mask.installing_changed()); 1068 EXPECT_TRUE(entry.mask.installing_changed());
1069 EXPECT_FALSE(entry.mask.waiting_changed()); 1069 EXPECT_FALSE(entry.mask.waiting_changed());
1070 EXPECT_FALSE(entry.mask.active_changed()); 1070 EXPECT_FALSE(entry.mask.active_changed());
1071 EXPECT_FALSE(entry.info.installing_version.is_null); 1071 EXPECT_FALSE(entry.info.installing_version.version_id == kInvalidServiceWorker VersionId);
nhiroki 2014/10/31 05:48:45 You might want to use EXPECT_EQ/EXPECT_NE here and
Paritosh Kumar 2014/10/31 06:53:19 Done.
1072 EXPECT_TRUE(entry.info.waiting_version.is_null); 1072 EXPECT_TRUE(entry.info.waiting_version.version_id == kInvalidServiceWorkerVers ionId);
1073 EXPECT_FALSE(entry.info.active_version.is_null); 1073 EXPECT_FALSE(entry.info.active_version.version_id == kInvalidServiceWorkerVers ionId);
1074 1074
1075 entry = update_helper->attribute_change_log_[1]; 1075 entry = update_helper->attribute_change_log_[1];
1076 EXPECT_TRUE(entry.mask.installing_changed()); 1076 EXPECT_TRUE(entry.mask.installing_changed());
1077 EXPECT_TRUE(entry.mask.waiting_changed()); 1077 EXPECT_TRUE(entry.mask.waiting_changed());
1078 EXPECT_FALSE(entry.mask.active_changed()); 1078 EXPECT_FALSE(entry.mask.active_changed());
1079 EXPECT_TRUE(entry.info.installing_version.is_null); 1079 EXPECT_TRUE(entry.info.installing_version.version_id == kInvalidServiceWorkerV ersionId);
1080 EXPECT_FALSE(entry.info.waiting_version.is_null); 1080 EXPECT_FALSE(entry.info.waiting_version.version_id == kInvalidServiceWorkerVer sionId);
1081 EXPECT_FALSE(entry.info.active_version.is_null); 1081 EXPECT_FALSE(entry.info.active_version.version_id == kInvalidServiceWorkerVers ionId);
1082 1082
1083 entry = update_helper->attribute_change_log_[2]; 1083 entry = update_helper->attribute_change_log_[2];
1084 EXPECT_FALSE(entry.mask.installing_changed()); 1084 EXPECT_FALSE(entry.mask.installing_changed());
1085 EXPECT_TRUE(entry.mask.waiting_changed()); 1085 EXPECT_TRUE(entry.mask.waiting_changed());
1086 EXPECT_TRUE(entry.mask.active_changed()); 1086 EXPECT_TRUE(entry.mask.active_changed());
1087 EXPECT_TRUE(entry.info.installing_version.is_null); 1087 EXPECT_TRUE(entry.info.installing_version.version_id == kInvalidServiceWorkerV ersionId);
1088 EXPECT_TRUE(entry.info.waiting_version.is_null); 1088 EXPECT_TRUE(entry.info.waiting_version.version_id == kInvalidServiceWorkerVers ionId);
1089 EXPECT_FALSE(entry.info.active_version.is_null); 1089 EXPECT_FALSE(entry.info.active_version.version_id == kInvalidServiceWorkerVers ionId);
1090 1090
1091 // expected version state transitions: 1091 // expected version state transitions:
1092 // new.installing, new.installed, 1092 // new.installing, new.installed,
1093 // old.redundant, 1093 // old.redundant,
1094 // new.activating, new.activated 1094 // new.activating, new.activated
1095 ASSERT_EQ(5u, update_helper->state_change_log_.size()); 1095 ASSERT_EQ(5u, update_helper->state_change_log_.size());
1096 1096
1097 EXPECT_EQ(registration->active_version()->version_id(), 1097 EXPECT_EQ(registration->active_version()->version_id(),
1098 update_helper->state_change_log_[0].version_id); 1098 update_helper->state_change_log_[0].version_id);
1099 EXPECT_EQ(ServiceWorkerVersion::INSTALLING, 1099 EXPECT_EQ(ServiceWorkerVersion::INSTALLING,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 EXPECT_TRUE(called); 1187 EXPECT_TRUE(called);
1188 1188
1189 // Verify the registration was not modified by the Update. 1189 // Verify the registration was not modified by the Update.
1190 EXPECT_TRUE(registration->is_uninstalling()); 1190 EXPECT_TRUE(registration->is_uninstalling());
1191 EXPECT_EQ(active_version, registration->active_version()); 1191 EXPECT_EQ(active_version, registration->active_version());
1192 EXPECT_EQ(NULL, registration->waiting_version()); 1192 EXPECT_EQ(NULL, registration->waiting_version());
1193 EXPECT_EQ(NULL, registration->installing_version()); 1193 EXPECT_EQ(NULL, registration->installing_version());
1194 } 1194 }
1195 1195
1196 } // namespace content 1196 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698