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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 scoped_ptr<MockValidationDB> db; | 94 scoped_ptr<MockValidationDB> db; |
95 scoped_ptr<NaClValidationQueryContext> context; | 95 scoped_ptr<NaClValidationQueryContext> context; |
96 scoped_ptr<NaClValidationQuery> query; | 96 scoped_ptr<NaClValidationQuery> query; |
97 }; | 97 }; |
98 | 98 |
99 class NaClValidationQueryTest : public ::testing::Test { | 99 class NaClValidationQueryTest : public ::testing::Test { |
100 protected: | 100 protected: |
101 scoped_ptr<TestQuery> query1; | 101 scoped_ptr<TestQuery> query1; |
102 scoped_ptr<TestQuery> query2; | 102 scoped_ptr<TestQuery> query2; |
103 | 103 |
104 virtual void SetUp() { | 104 void SetUp() override { |
105 query1.reset(new TestQuery(kKey, kVersion)); | 105 query1.reset(new TestQuery(kKey, kVersion)); |
106 query2.reset(new TestQuery(kKey, kVersion)); | 106 query2.reset(new TestQuery(kKey, kVersion)); |
107 } | 107 } |
108 | 108 |
109 void AssertQuerySame() { | 109 void AssertQuerySame() { |
110 ASSERT_TRUE(query1->db->did_query_); | 110 ASSERT_TRUE(query1->db->did_query_); |
111 ASSERT_TRUE(query2->db->did_query_); | 111 ASSERT_TRUE(query2->db->did_query_); |
112 ASSERT_EQ(0, memcmp(query1->db->query_signature_, | 112 ASSERT_EQ(0, memcmp(query1->db->query_signature_, |
113 query2->db->query_signature_, | 113 query2->db->query_signature_, |
114 NaClValidationQuery::kDigestLength)); | 114 NaClValidationQuery::kDigestLength)); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 query1->query->AddData(kShortData, sizeof(kShortData)); | 275 query1->query->AddData(kShortData, sizeof(kShortData)); |
276 query1->query->QueryKnownToValidate(); | 276 query1->query->QueryKnownToValidate(); |
277 | 277 |
278 query2->query->AddData(kShortData, sizeof(kShortData)); | 278 query2->query->AddData(kShortData, sizeof(kShortData)); |
279 query2->query->QueryKnownToValidate(); | 279 query2->query->QueryKnownToValidate(); |
280 | 280 |
281 AssertQueryDifferent(); | 281 AssertQueryDifferent(); |
282 } | 282 } |
283 | 283 |
284 } | 284 } |
OLD | NEW |