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

Side by Side Diff: components/nacl/loader/nacl_validation_query_unittest.cc

Issue 623133002: replace OVERRIDE and FINAL with override and final in components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/nacl/loader/nacl_validation_db.h" 5 #include "components/nacl/loader/nacl_validation_db.h"
6 #include "components/nacl/loader/nacl_validation_query.h" 6 #include "components/nacl/loader/nacl_validation_query.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 // This test makes sure that validation signature generation is performed 9 // This test makes sure that validation signature generation is performed
10 // correctly. In effect, this means that we are checking all of the data 10 // correctly. In effect, this means that we are checking all of the data
(...skipping 21 matching lines...) Expand all
32 "1234567890123456789012345678901234567890123456789012345678901234567890"; 32 "1234567890123456789012345678901234567890123456789012345678901234567890";
33 33
34 class MockValidationDB : public NaClValidationDB { 34 class MockValidationDB : public NaClValidationDB {
35 public: 35 public:
36 MockValidationDB() 36 MockValidationDB()
37 : did_query_(false), 37 : did_query_(false),
38 did_set_(false), 38 did_set_(false),
39 status_(true) { 39 status_(true) {
40 } 40 }
41 41
42 virtual bool QueryKnownToValidate(const std::string& signature) OVERRIDE { 42 virtual bool QueryKnownToValidate(const std::string& signature) override {
43 // The typecast is needed to work around gtest trying to take the address 43 // The typecast is needed to work around gtest trying to take the address
44 // of a constant. 44 // of a constant.
45 EXPECT_EQ((int) NaClValidationQuery::kDigestLength, 45 EXPECT_EQ((int) NaClValidationQuery::kDigestLength,
46 (int) signature.length()); 46 (int) signature.length());
47 EXPECT_FALSE(did_query_); 47 EXPECT_FALSE(did_query_);
48 EXPECT_FALSE(did_set_); 48 EXPECT_FALSE(did_set_);
49 did_query_ = true; 49 did_query_ = true;
50 memcpy(query_signature_, signature.data(), 50 memcpy(query_signature_, signature.data(),
51 NaClValidationQuery::kDigestLength); 51 NaClValidationQuery::kDigestLength);
52 return status_; 52 return status_;
53 } 53 }
54 54
55 virtual void SetKnownToValidate(const std::string& signature) OVERRIDE { 55 virtual void SetKnownToValidate(const std::string& signature) override {
56 // The typecast is needed to work around gtest trying to take the address 56 // The typecast is needed to work around gtest trying to take the address
57 // of a constant. 57 // of a constant.
58 ASSERT_EQ((int) NaClValidationQuery::kDigestLength, 58 ASSERT_EQ((int) NaClValidationQuery::kDigestLength,
59 (int) signature.length()); 59 (int) signature.length());
60 EXPECT_TRUE(did_query_); 60 EXPECT_TRUE(did_query_);
61 EXPECT_FALSE(did_set_); 61 EXPECT_FALSE(did_set_);
62 did_set_ = true; 62 did_set_ = true;
63 memcpy(set_signature_, signature.data(), 63 memcpy(set_signature_, signature.data(),
64 NaClValidationQuery::kDigestLength); 64 NaClValidationQuery::kDigestLength);
65 // Signatures should be the same. 65 // Signatures should be the same.
66 EXPECT_EQ(0, memcmp(query_signature_, set_signature_, 66 EXPECT_EQ(0, memcmp(query_signature_, set_signature_,
67 NaClValidationQuery::kDigestLength)); 67 NaClValidationQuery::kDigestLength));
68 } 68 }
69 69
70 virtual bool ResolveFileToken(struct NaClFileToken* file_token, int32* fd, 70 virtual bool ResolveFileToken(struct NaClFileToken* file_token, int32* fd,
71 std::string* path) OVERRIDE { 71 std::string* path) override {
72 *fd = -1; 72 *fd = -1;
73 *path = ""; 73 *path = "";
74 return false; 74 return false;
75 } 75 }
76 76
77 bool did_query_; 77 bool did_query_;
78 bool did_set_; 78 bool did_set_;
79 bool status_; 79 bool status_;
80 80
81 uint8 query_signature_[NaClValidationQuery::kDigestLength]; 81 uint8 query_signature_[NaClValidationQuery::kDigestLength];
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 query1->query->AddData(kShortData, sizeof(kShortData)); 274 query1->query->AddData(kShortData, sizeof(kShortData));
275 query1->query->QueryKnownToValidate(); 275 query1->query->QueryKnownToValidate();
276 276
277 query2->query->AddData(kShortData, sizeof(kShortData)); 277 query2->query->AddData(kShortData, sizeof(kShortData));
278 query2->query->QueryKnownToValidate(); 278 query2->query->QueryKnownToValidate();
279 279
280 AssertQueryDifferent(); 280 AssertQueryDifferent();
281 } 281 }
282 282
283 } 283 }
OLDNEW
« no previous file with comments | « components/nacl/loader/nacl_trusted_listener.h ('k') | components/nacl/loader/nonsfi/nonsfi_listener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698