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

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_NE(entry.info.installing_version.version_id,
1072 EXPECT_TRUE(entry.info.waiting_version.is_null); 1072 kInvalidServiceWorkerVersionId);
1073 EXPECT_FALSE(entry.info.active_version.is_null); 1073 EXPECT_EQ(entry.info.waiting_version.version_id,
1074 kInvalidServiceWorkerVersionId);
1075 EXPECT_NE(entry.info.active_version.version_id,
1076 kInvalidServiceWorkerVersionId);
1074 1077
1075 entry = update_helper->attribute_change_log_[1]; 1078 entry = update_helper->attribute_change_log_[1];
1076 EXPECT_TRUE(entry.mask.installing_changed()); 1079 EXPECT_TRUE(entry.mask.installing_changed());
1077 EXPECT_TRUE(entry.mask.waiting_changed()); 1080 EXPECT_TRUE(entry.mask.waiting_changed());
1078 EXPECT_FALSE(entry.mask.active_changed()); 1081 EXPECT_FALSE(entry.mask.active_changed());
1079 EXPECT_TRUE(entry.info.installing_version.is_null); 1082 EXPECT_EQ(entry.info.installing_version.version_id,
1080 EXPECT_FALSE(entry.info.waiting_version.is_null); 1083 kInvalidServiceWorkerVersionId);
1081 EXPECT_FALSE(entry.info.active_version.is_null); 1084 EXPECT_NE(entry.info.waiting_version.version_id,
1085 kInvalidServiceWorkerVersionId);
1086 EXPECT_NE(entry.info.active_version.version_id,
1087 kInvalidServiceWorkerVersionId);
1082 1088
1083 entry = update_helper->attribute_change_log_[2]; 1089 entry = update_helper->attribute_change_log_[2];
1084 EXPECT_FALSE(entry.mask.installing_changed()); 1090 EXPECT_FALSE(entry.mask.installing_changed());
1085 EXPECT_TRUE(entry.mask.waiting_changed()); 1091 EXPECT_TRUE(entry.mask.waiting_changed());
1086 EXPECT_TRUE(entry.mask.active_changed()); 1092 EXPECT_TRUE(entry.mask.active_changed());
1087 EXPECT_TRUE(entry.info.installing_version.is_null); 1093 EXPECT_EQ(entry.info.installing_version.version_id,
1088 EXPECT_TRUE(entry.info.waiting_version.is_null); 1094 kInvalidServiceWorkerVersionId);
1089 EXPECT_FALSE(entry.info.active_version.is_null); 1095 EXPECT_EQ(entry.info.waiting_version.version_id,
1096 kInvalidServiceWorkerVersionId);
1097 EXPECT_NE(entry.info.active_version.version_id,
1098 kInvalidServiceWorkerVersionId);
1090 1099
1091 // expected version state transitions: 1100 // expected version state transitions:
1092 // new.installing, new.installed, 1101 // new.installing, new.installed,
1093 // old.redundant, 1102 // old.redundant,
1094 // new.activating, new.activated 1103 // new.activating, new.activated
1095 ASSERT_EQ(5u, update_helper->state_change_log_.size()); 1104 ASSERT_EQ(5u, update_helper->state_change_log_.size());
1096 1105
1097 EXPECT_EQ(registration->active_version()->version_id(), 1106 EXPECT_EQ(registration->active_version()->version_id(),
1098 update_helper->state_change_log_[0].version_id); 1107 update_helper->state_change_log_[0].version_id);
1099 EXPECT_EQ(ServiceWorkerVersion::INSTALLING, 1108 EXPECT_EQ(ServiceWorkerVersion::INSTALLING,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 EXPECT_TRUE(called); 1196 EXPECT_TRUE(called);
1188 1197
1189 // Verify the registration was not modified by the Update. 1198 // Verify the registration was not modified by the Update.
1190 EXPECT_TRUE(registration->is_uninstalling()); 1199 EXPECT_TRUE(registration->is_uninstalling());
1191 EXPECT_EQ(active_version, registration->active_version()); 1200 EXPECT_EQ(active_version, registration->active_version());
1192 EXPECT_EQ(NULL, registration->waiting_version()); 1201 EXPECT_EQ(NULL, registration->waiting_version());
1193 EXPECT_EQ(NULL, registration->installing_version()); 1202 EXPECT_EQ(NULL, registration->installing_version());
1194 } 1203 }
1195 1204
1196 } // namespace content 1205 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698