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

Side by Side Diff: extensions/browser/api/cast_channel/cast_socket_unittest.cc

Issue 2084153003: Remove the test-only X509Certificate constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/api/cast_channel/cast_socket.h" 5 #include "extensions/browser/api/cast_channel/cast_socket.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 17 matching lines...) Expand all
28 #include "extensions/browser/api/cast_channel/cast_transport.h" 28 #include "extensions/browser/api/cast_channel/cast_transport.h"
29 #include "extensions/browser/api/cast_channel/logger.h" 29 #include "extensions/browser/api/cast_channel/logger.h"
30 #include "extensions/common/api/cast_channel/cast_channel.pb.h" 30 #include "extensions/common/api/cast_channel/cast_channel.pb.h"
31 #include "net/base/address_list.h" 31 #include "net/base/address_list.h"
32 #include "net/base/net_errors.h" 32 #include "net/base/net_errors.h"
33 #include "net/log/test_net_log.h" 33 #include "net/log/test_net_log.h"
34 #include "net/socket/socket_test_util.h" 34 #include "net/socket/socket_test_util.h"
35 #include "net/socket/ssl_client_socket.h" 35 #include "net/socket/ssl_client_socket.h"
36 #include "net/socket/tcp_client_socket.h" 36 #include "net/socket/tcp_client_socket.h"
37 #include "net/ssl/ssl_info.h" 37 #include "net/ssl/ssl_info.h"
38 #include "net/test/cert_test_util.h"
39 #include "net/test/test_data_directory.h"
38 #include "testing/gmock/include/gmock/gmock.h" 40 #include "testing/gmock/include/gmock/gmock.h"
39 #include "testing/gtest/include/gtest/gtest.h" 41 #include "testing/gtest/include/gtest/gtest.h"
40 42
41 const int64_t kDistantTimeoutMillis = 100000; // 100 seconds (never hit). 43 const int64_t kDistantTimeoutMillis = 100000; // 100 seconds (never hit).
42 44
43 using ::testing::_; 45 using ::testing::_;
44 using ::testing::A; 46 using ::testing::A;
45 using ::testing::DoAll; 47 using ::testing::DoAll;
46 using ::testing::Invoke; 48 using ::testing::Invoke;
47 using ::testing::InvokeArgument; 49 using ::testing::InvokeArgument;
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 311
310 ssl_data_.reset(new net::StaticSocketDataProvider( 312 ssl_data_.reset(new net::StaticSocketDataProvider(
311 reads_.data(), reads_.size(), writes_.data(), writes_.size())); 313 reads_.data(), reads_.size(), writes_.data(), writes_.size()));
312 ssl_data_->set_connect_data(*connect_data); 314 ssl_data_->set_connect_data(*connect_data);
313 // NOTE: net::MockTCPClientSocket inherits from net::SSLClientSocket !! 315 // NOTE: net::MockTCPClientSocket inherits from net::SSLClientSocket !!
314 return std::unique_ptr<net::SSLClientSocket>(new net::MockTCPClientSocket( 316 return std::unique_ptr<net::SSLClientSocket>(new net::MockTCPClientSocket(
315 net::AddressList(), capturing_net_log_.get(), ssl_data_.get())); 317 net::AddressList(), capturing_net_log_.get(), ssl_data_.get()));
316 } 318 }
317 319
318 scoped_refptr<net::X509Certificate> ExtractPeerCert() override { 320 scoped_refptr<net::X509Certificate> ExtractPeerCert() override {
319 return extract_cert_result_ ? make_scoped_refptr<net::X509Certificate>( 321 return extract_cert_result_
320 new net::X509Certificate( 322 ? net::ImportCertFromFile(net::GetTestCertsDirectory(),
321 "", "", base::Time(), base::Time())) 323 "ok_cert.pem")
322 : nullptr; 324 : nullptr;
323 } 325 }
324 326
325 bool VerifyChallengeReply() override { 327 bool VerifyChallengeReply() override {
326 EXPECT_FALSE(verify_challenge_disallow_); 328 EXPECT_FALSE(verify_challenge_disallow_);
327 return verify_challenge_result_; 329 return verify_challenge_result_;
328 } 330 }
329 331
330 base::Timer* GetTimer() override { return mock_timer_.get(); } 332 base::Timer* GetTimer() override { return mock_timer_.get(); }
331 333
332 std::unique_ptr<net::TestNetLog> capturing_net_log_; 334 std::unique_ptr<net::TestNetLog> capturing_net_log_;
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 logger_, cast_channel::CastDeviceCapability::VIDEO_OUT); 904 logger_, cast_channel::CastDeviceCapability::VIDEO_OUT);
903 EXPECT_FALSE(socket_->audio_only()); 905 EXPECT_FALSE(socket_->audio_only());
904 EXPECT_TRUE(socket_->TestVerifyChannelPolicyNone()); 906 EXPECT_TRUE(socket_->TestVerifyChannelPolicyNone());
905 EXPECT_FALSE(socket_->audio_only()); 907 EXPECT_FALSE(socket_->audio_only());
906 EXPECT_FALSE(socket_->TestVerifyChannelPolicyAudioOnly()); 908 EXPECT_FALSE(socket_->TestVerifyChannelPolicyAudioOnly());
907 EXPECT_TRUE(socket_->audio_only()); 909 EXPECT_TRUE(socket_->audio_only());
908 } 910 }
909 } // namespace cast_channel 911 } // namespace cast_channel
910 } // namespace api 912 } // namespace api
911 } // namespace extensions 913 } // namespace extensions
OLDNEW
« no previous file with comments | « content/browser/loader/resource_loader_unittest.cc ('k') | extensions/extensions_unittests.isolate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698