| OLD | NEW | 
|---|
| 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 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   bool ResolveFileToken(struct NaClFileToken* file_token, |  | 
| 71                         int32* fd, |  | 
| 72                         std::string* path) override { |  | 
| 73     *fd = -1; |  | 
| 74     *path = ""; |  | 
| 75     return false; |  | 
| 76   } |  | 
| 77 |  | 
| 78   bool did_query_; | 70   bool did_query_; | 
| 79   bool did_set_; | 71   bool did_set_; | 
| 80   bool status_; | 72   bool status_; | 
| 81 | 73 | 
| 82   uint8 query_signature_[NaClValidationQuery::kDigestLength]; | 74   uint8 query_signature_[NaClValidationQuery::kDigestLength]; | 
| 83   uint8 set_signature_[NaClValidationQuery::kDigestLength]; | 75   uint8 set_signature_[NaClValidationQuery::kDigestLength]; | 
| 84 }; | 76 }; | 
| 85 | 77 | 
| 86 class TestQuery { | 78 class TestQuery { | 
| 87  public: | 79  public: | 
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 275   query1->query->AddData(kShortData, sizeof(kShortData)); | 267   query1->query->AddData(kShortData, sizeof(kShortData)); | 
| 276   query1->query->QueryKnownToValidate(); | 268   query1->query->QueryKnownToValidate(); | 
| 277 | 269 | 
| 278   query2->query->AddData(kShortData, sizeof(kShortData)); | 270   query2->query->AddData(kShortData, sizeof(kShortData)); | 
| 279   query2->query->QueryKnownToValidate(); | 271   query2->query->QueryKnownToValidate(); | 
| 280 | 272 | 
| 281   AssertQueryDifferent(); | 273   AssertQueryDifferent(); | 
| 282 } | 274 } | 
| 283 | 275 | 
| 284 } | 276 } | 
| OLD | NEW | 
|---|