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

Side by Side Diff: chrome/browser/safe_browsing/signature_evaluator_mac_unittest.cc

Issue 1917973002: mac: Remove IsOSLion(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/browser/safe_browsing/signature_evaluator_mac.h" 5 #include "chrome/browser/safe_browsing/signature_evaluator_mac.h"
6 6
7 #include <CoreFoundation/CoreFoundation.h> 7 #include <CoreFoundation/CoreFoundation.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string.h> 9 #include <string.h>
10 #include <sys/xattr.h> 10 #include <sys/xattr.h>
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 ASSERT_EQ(1, incident.contained_file_size()); 169 ASSERT_EQ(1, incident.contained_file_size());
170 170
171 const ClientIncidentReport_IncidentData_BinaryIntegrityIncident_ContainedFile& 171 const ClientIncidentReport_IncidentData_BinaryIntegrityIncident_ContainedFile&
172 contained_file = incident.contained_file(0); 172 contained_file = incident.contained_file(0);
173 EXPECT_EQ(contained_file.relative_path(), "Contents/MacOS/test-bundle"); 173 EXPECT_EQ(contained_file.relative_path(), "Contents/MacOS/test-bundle");
174 EXPECT_TRUE(contained_file.has_signature()); 174 EXPECT_TRUE(contained_file.has_signature());
175 EXPECT_TRUE(contained_file.has_image_headers()); 175 EXPECT_TRUE(contained_file.has_image_headers());
176 } 176 }
177 177
178 TEST_F(MacSignatureEvaluatorTest, ModifiedMainExecTest64) { 178 TEST_F(MacSignatureEvaluatorTest, ModifiedMainExecTest64) {
179 // Snow Leopard does not know about the 64-bit slice so this test is
180 // irrelevant.
181 if (!base::mac::IsOSLionOrLater())
182 return;
183
184 // Now to a test modified, signed bundle. 179 // Now to a test modified, signed bundle.
185 base::FilePath path = testdata_path_.AppendASCII("modified-main-exec64.app"); 180 base::FilePath path = testdata_path_.AppendASCII("modified-main-exec64.app");
186 181
187 std::string requirement( 182 std::string requirement(
188 "certificate leaf[subject.CN]=\"untrusted@goat.local\""); 183 "certificate leaf[subject.CN]=\"untrusted@goat.local\"");
189 MacSignatureEvaluator evaluator(path, requirement); 184 MacSignatureEvaluator evaluator(path, requirement);
190 ASSERT_TRUE(evaluator.Initialize()); 185 ASSERT_TRUE(evaluator.Initialize());
191 186
192 ClientIncidentReport_IncidentData_BinaryIntegrityIncident incident; 187 ClientIncidentReport_IncidentData_BinaryIntegrityIncident incident;
193 EXPECT_FALSE(evaluator.PerformEvaluation(&incident)); 188 EXPECT_FALSE(evaluator.PerformEvaluation(&incident));
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 std::vector<std::string> xattrs_seen; 329 std::vector<std::string> xattrs_seen;
335 for (const auto& xattr : mainmenunib->signature().xattr()) { 330 for (const auto& xattr : mainmenunib->signature().xattr()) {
336 ASSERT_TRUE(xattr.has_key()); 331 ASSERT_TRUE(xattr.has_key());
337 EXPECT_TRUE(xattr.has_value()); 332 EXPECT_TRUE(xattr.has_value());
338 xattrs_seen.push_back(xattr.key()); 333 xattrs_seen.push_back(xattr.key());
339 } 334 }
340 EXPECT_THAT(xattrs_known, ::testing::ContainerEq(xattrs_seen)); 335 EXPECT_THAT(xattrs_known, ::testing::ContainerEq(xattrs_seen));
341 } 336 }
342 337
343 } // namespace safe_browsing 338 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698