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

Side by Side Diff: remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc

Issue 9960002: Make all the things use cert_test_util.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nitfix Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/authenticator_test_base.cc ('k') | remoting/remoting.gyp » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "remoting/protocol/ssl_hmac_channel_authenticator.h" 5 #include "remoting/protocol/ssl_hmac_channel_authenticator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "crypto/rsa_private_key.h" 12 #include "crypto/rsa_private_key.h"
13 #include "net/base/cert_test_util.h"
13 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
14 #include "remoting/protocol/connection_tester.h" 15 #include "remoting/protocol/connection_tester.h"
15 #include "remoting/protocol/fake_session.h" 16 #include "remoting/protocol/fake_session.h"
16 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" 19 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h"
19 20
20 using testing::_; 21 using testing::_;
21 using testing::NotNull; 22 using testing::NotNull;
22 using testing::SaveArg; 23 using testing::SaveArg;
(...skipping 15 matching lines...) Expand all
38 39
39 class SslHmacChannelAuthenticatorTest : public testing::Test { 40 class SslHmacChannelAuthenticatorTest : public testing::Test {
40 public: 41 public:
41 SslHmacChannelAuthenticatorTest() { 42 SslHmacChannelAuthenticatorTest() {
42 } 43 }
43 virtual ~SslHmacChannelAuthenticatorTest() { 44 virtual ~SslHmacChannelAuthenticatorTest() {
44 } 45 }
45 46
46 protected: 47 protected:
47 virtual void SetUp() OVERRIDE { 48 virtual void SetUp() OVERRIDE {
48 FilePath certs_dir; 49 FilePath certs_dir(net::GetTestCertsDirectory());
49 PathService::Get(base::DIR_SOURCE_ROOT, &certs_dir);
50 certs_dir = certs_dir.AppendASCII("net");
51 certs_dir = certs_dir.AppendASCII("data");
52 certs_dir = certs_dir.AppendASCII("ssl");
53 certs_dir = certs_dir.AppendASCII("certificates");
54 50
55 FilePath cert_path = certs_dir.AppendASCII("unittest.selfsigned.der"); 51 FilePath cert_path = certs_dir.AppendASCII("unittest.selfsigned.der");
56 ASSERT_TRUE(file_util::ReadFileToString(cert_path, &host_cert_)); 52 ASSERT_TRUE(file_util::ReadFileToString(cert_path, &host_cert_));
57 53
58 FilePath key_path = certs_dir.AppendASCII("unittest.key.bin"); 54 FilePath key_path = certs_dir.AppendASCII("unittest.key.bin");
59 std::string key_string; 55 std::string key_string;
60 ASSERT_TRUE(file_util::ReadFileToString(key_path, &key_string)); 56 ASSERT_TRUE(file_util::ReadFileToString(key_path, &key_string));
61 std::vector<uint8> key_vector( 57 std::vector<uint8> key_vector(
62 reinterpret_cast<const uint8*>(key_string.data()), 58 reinterpret_cast<const uint8*>(key_string.data()),
63 reinterpret_cast<const uint8*>(key_string.data() + 59 reinterpret_cast<const uint8*>(key_string.data() +
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 host_auth_ = SslHmacChannelAuthenticator::CreateForHost( 143 host_auth_ = SslHmacChannelAuthenticator::CreateForHost(
148 host_cert_, private_key_.get(), kTestSharedSecret); 144 host_cert_, private_key_.get(), kTestSharedSecret);
149 145
150 RunChannelAuth(true); 146 RunChannelAuth(true);
151 147
152 EXPECT_TRUE(host_socket_.get() == NULL); 148 EXPECT_TRUE(host_socket_.get() == NULL);
153 } 149 }
154 150
155 } // namespace protocol 151 } // namespace protocol
156 } // namespace remoting 152 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/authenticator_test_base.cc ('k') | remoting/remoting.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698