OLD | NEW |
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 "chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.h" | 5 #include "chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 net::SHA256HashValue GetServerFingerprint() const { | 78 net::SHA256HashValue GetServerFingerprint() const { |
79 return net::X509Certificate::CalculateFingerprint256( | 79 return net::X509Certificate::CalculateFingerprint256( |
80 server_->GetCertificate()->os_cert_handle()); | 80 server_->GetCertificate()->os_cert_handle()); |
81 } | 81 } |
82 | 82 |
83 private: | 83 private: |
84 bool done_ = false; | 84 bool done_ = false; |
85 net::URLRequestStatus status_ = net::URLRequestStatus(); | 85 net::URLRequestStatus status_ = net::URLRequestStatus(); |
86 content::TestBrowserThreadBundle thread_bundle_; | 86 content::TestBrowserThreadBundle thread_bundle_; |
87 scoped_refptr<extensions::PrivetV3ContextGetter> context_getter_; | 87 scoped_refptr<extensions::PrivetV3ContextGetter> context_getter_; |
88 scoped_ptr<EmbeddedTestServer> server_; | 88 std::unique_ptr<EmbeddedTestServer> server_; |
89 scoped_ptr<net::URLFetcher> fetcher_; | 89 std::unique_ptr<net::URLFetcher> fetcher_; |
90 | 90 |
91 base::Closure quit_; | 91 base::Closure quit_; |
92 }; | 92 }; |
93 | 93 |
94 TEST_F(PrivetV3ContextGetterTest, Http) { | 94 TEST_F(PrivetV3ContextGetterTest, Http) { |
95 CreateServer(EmbeddedTestServer::TYPE_HTTP); | 95 CreateServer(EmbeddedTestServer::TYPE_HTTP); |
96 EXPECT_EQ(net::URLRequestStatus::SUCCESS, Run()); | 96 EXPECT_EQ(net::URLRequestStatus::SUCCESS, Run()); |
97 } | 97 } |
98 | 98 |
99 TEST_F(PrivetV3ContextGetterTest, HttpsUnknownHost) { | 99 TEST_F(PrivetV3ContextGetterTest, HttpsUnknownHost) { |
(...skipping 21 matching lines...) Expand all Loading... |
121 | 121 |
122 CreateServer(EmbeddedTestServer::TYPE_HTTPS); | 122 CreateServer(EmbeddedTestServer::TYPE_HTTPS); |
123 SetFingerprint(GetServerFingerprint()); | 123 SetFingerprint(GetServerFingerprint()); |
124 EXPECT_EQ(net::URLRequestStatus::SUCCESS, Run()); | 124 EXPECT_EQ(net::URLRequestStatus::SUCCESS, Run()); |
125 } | 125 } |
126 } | 126 } |
127 | 127 |
128 } // namespace | 128 } // namespace |
129 | 129 |
130 } // namespace extensions | 130 } // namespace extensions |
OLD | NEW |