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

Side by Side Diff: components/certificate_reporting/error_reporter_unittest.cc

Issue 2457153003: Remove crypto/curve25519.h in favor of BoringSSL's. (Closed)
Patch Set: rebase Created 3 years, 10 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
« no previous file with comments | « components/certificate_reporting/error_reporter.cc ('k') | crypto/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/certificate_reporting/error_reporter.h" 5 #include "components/certificate_reporting/error_reporter.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/bind_helpers.h" 14 #include "base/bind_helpers.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
17 #include "base/message_loop/message_loop.h" 17 #include "base/message_loop/message_loop.h"
18 #include "base/run_loop.h" 18 #include "base/run_loop.h"
19 #include "components/certificate_reporting/encrypted_cert_logger.pb.h" 19 #include "components/certificate_reporting/encrypted_cert_logger.pb.h"
20 #include "crypto/curve25519.h"
21 #include "net/test/url_request/url_request_failed_job.h" 20 #include "net/test/url_request/url_request_failed_job.h"
22 #include "net/test/url_request/url_request_mock_data_job.h" 21 #include "net/test/url_request/url_request_mock_data_job.h"
23 #include "net/url_request/report_sender.h" 22 #include "net/url_request/report_sender.h"
24 #include "net/url_request/url_request_test_util.h" 23 #include "net/url_request/url_request_test_util.h"
25 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
25 #include "third_party/boringssl/src/include/openssl/curve25519.h"
26 26
27 namespace certificate_reporting { 27 namespace certificate_reporting {
28 28
29 namespace { 29 namespace {
30 30
31 const char kDummyHttpReportUri[] = "http://example.test"; 31 const char kDummyHttpReportUri[] = "http://example.test";
32 const char kDummyHttpsReportUri[] = "https://example.test"; 32 const char kDummyHttpsReportUri[] = "https://example.test";
33 const char kDummyReport[] = "a dummy report"; 33 const char kDummyReport[] = "a dummy report";
34 const uint32_t kServerPublicKeyTestVersion = 16; 34 const uint32_t kServerPublicKeyTestVersion = 16;
35 35
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 private: 96 private:
97 base::Closure url_request_destroyed_callback_; 97 base::Closure url_request_destroyed_callback_;
98 98
99 DISALLOW_COPY_AND_ASSIGN(TestCertificateReporterNetworkDelegate); 99 DISALLOW_COPY_AND_ASSIGN(TestCertificateReporterNetworkDelegate);
100 }; 100 };
101 101
102 class ErrorReporterTest : public ::testing::Test { 102 class ErrorReporterTest : public ::testing::Test {
103 public: 103 public:
104 ErrorReporterTest() { 104 ErrorReporterTest() {
105 memset(server_private_key_, 1, sizeof(server_private_key_)); 105 memset(server_private_key_, 1, sizeof(server_private_key_));
106 crypto::curve25519::ScalarBaseMult(server_private_key_, server_public_key_); 106 X25519_public_from_private(server_public_key_, server_private_key_);
107 } 107 }
108 108
109 ~ErrorReporterTest() override {} 109 ~ErrorReporterTest() override {}
110 110
111 protected: 111 protected:
112 base::MessageLoopForIO loop_; 112 base::MessageLoopForIO loop_;
113 uint8_t server_public_key_[32]; 113 uint8_t server_public_key_[32];
114 uint8_t server_private_key_[32]; 114 uint8_t server_private_key_[32];
115 115
116 DISALLOW_COPY_AND_ASSIGN(ErrorReporterTest); 116 DISALLOW_COPY_AND_ASSIGN(ErrorReporterTest);
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 ASSERT_TRUE(encrypted_request.ParseFromString( 368 ASSERT_TRUE(encrypted_request.ParseFromString(
369 std::string(reinterpret_cast<const char*>(kSerializedEncryptedReport), 369 std::string(reinterpret_cast<const char*>(kSerializedEncryptedReport),
370 sizeof(kSerializedEncryptedReport)))); 370 sizeof(kSerializedEncryptedReport))));
371 ASSERT_TRUE(ErrorReporter::DecryptErrorReport( 371 ASSERT_TRUE(ErrorReporter::DecryptErrorReport(
372 server_private_key_, encrypted_request, &decrypted_serialized_report)); 372 server_private_key_, encrypted_request, &decrypted_serialized_report));
373 } 373 }
374 374
375 } // namespace 375 } // namespace
376 376
377 } // namespace certificate_reporting 377 } // namespace certificate_reporting
OLDNEW
« no previous file with comments | « components/certificate_reporting/error_reporter.cc ('k') | crypto/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698