OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/common/safe_browsing/file_type_policies.h" | 5 #include "chrome/common/safe_browsing/file_type_policies.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 base::AutoLock lock(policies_.lock_); | 200 base::AutoLock lock(policies_.lock_); |
201 // Make a minimum viable config | 201 // Make a minimum viable config |
202 DownloadFileTypeConfig cfg; | 202 DownloadFileTypeConfig cfg; |
203 cfg.mutable_default_file_type()->add_platform_settings(); | 203 cfg.mutable_default_file_type()->add_platform_settings(); |
204 cfg.add_file_types()->add_platform_settings(); | 204 cfg.add_file_types()->add_platform_settings(); |
205 cfg.set_version_id(2); | 205 cfg.set_version_id(2); |
206 EXPECT_EQ(FileTypePolicies::UpdateResult::SUCCESS, | 206 EXPECT_EQ(FileTypePolicies::UpdateResult::SUCCESS, |
207 policies_.PopulateFromBinaryPb(cfg.SerializeAsString())); | 207 policies_.PopulateFromBinaryPb(cfg.SerializeAsString())); |
208 | 208 |
209 // Can't update to the same version | 209 // Can't update to the same version |
210 EXPECT_EQ(FileTypePolicies::UpdateResult::FAILED_VERSION_CHECK, | 210 EXPECT_EQ(FileTypePolicies::UpdateResult::SKIPPED_VERSION_CHECK_EQUAL, |
211 policies_.PopulateFromBinaryPb(cfg.SerializeAsString())); | 211 policies_.PopulateFromBinaryPb(cfg.SerializeAsString())); |
212 | 212 |
213 // Can't go backward | 213 // Can't go backward |
214 cfg.set_version_id(1); | 214 cfg.set_version_id(1); |
215 EXPECT_EQ(FileTypePolicies::UpdateResult::FAILED_VERSION_CHECK, | 215 EXPECT_EQ(FileTypePolicies::UpdateResult::FAILED_VERSION_CHECK, |
216 policies_.PopulateFromBinaryPb(cfg.SerializeAsString())); | 216 policies_.PopulateFromBinaryPb(cfg.SerializeAsString())); |
217 } | 217 } |
218 } // namespace safe_browsing | 218 } // namespace safe_browsing |
OLD | NEW |