OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/nacl/nacl_validation_db.h" | 5 #include "chrome/nacl/nacl_validation_db.h" |
6 #include "chrome/nacl/nacl_validation_query.h" | 6 #include "chrome/nacl/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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, |
| 71 std::string* path) OVERRIDE { |
| 72 *fd = -1; |
| 73 *path = ""; |
| 74 return false; |
| 75 } |
| 76 |
70 bool did_query_; | 77 bool did_query_; |
71 bool did_set_; | 78 bool did_set_; |
72 bool status_; | 79 bool status_; |
73 | 80 |
74 uint8 query_signature_[NaClValidationQuery::kDigestLength]; | 81 uint8 query_signature_[NaClValidationQuery::kDigestLength]; |
75 uint8 set_signature_[NaClValidationQuery::kDigestLength]; | 82 uint8 set_signature_[NaClValidationQuery::kDigestLength]; |
76 }; | 83 }; |
77 | 84 |
78 class TestQuery { | 85 class TestQuery { |
79 public: | 86 public: |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 query1->query->AddData(kShortData, sizeof(kShortData)); | 274 query1->query->AddData(kShortData, sizeof(kShortData)); |
268 query1->query->QueryKnownToValidate(); | 275 query1->query->QueryKnownToValidate(); |
269 | 276 |
270 query2->query->AddData(kShortData, sizeof(kShortData)); | 277 query2->query->AddData(kShortData, sizeof(kShortData)); |
271 query2->query->QueryKnownToValidate(); | 278 query2->query->QueryKnownToValidate(); |
272 | 279 |
273 AssertQueryDifferent(); | 280 AssertQueryDifferent(); |
274 } | 281 } |
275 | 282 |
276 } | 283 } |
OLD | NEW |