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

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

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
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/base64.h" 7 #include "base/base64.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 class SslHmacChannelAuthenticatorTest : public testing::Test { 51 class SslHmacChannelAuthenticatorTest : public testing::Test {
52 public: 52 public:
53 SslHmacChannelAuthenticatorTest() {} 53 SslHmacChannelAuthenticatorTest() {}
54 virtual ~SslHmacChannelAuthenticatorTest() {} 54 virtual ~SslHmacChannelAuthenticatorTest() {}
55 55
56 protected: 56 protected:
57 virtual void SetUp() OVERRIDE { 57 virtual void SetUp() OVERRIDE {
58 base::FilePath certs_dir(net::GetTestCertsDirectory()); 58 base::FilePath certs_dir(net::GetTestCertsDirectory());
59 59
60 base::FilePath cert_path = certs_dir.AppendASCII("unittest.selfsigned.der"); 60 base::FilePath cert_path = certs_dir.AppendASCII("unittest.selfsigned.der");
61 ASSERT_TRUE(file_util::ReadFileToString(cert_path, &host_cert_)); 61 ASSERT_TRUE(base::ReadFileToString(cert_path, &host_cert_));
62 62
63 base::FilePath key_path = certs_dir.AppendASCII("unittest.key.bin"); 63 base::FilePath key_path = certs_dir.AppendASCII("unittest.key.bin");
64 std::string key_string; 64 std::string key_string;
65 ASSERT_TRUE(file_util::ReadFileToString(key_path, &key_string)); 65 ASSERT_TRUE(base::ReadFileToString(key_path, &key_string));
66 std::string key_base64; 66 std::string key_base64;
67 base::Base64Encode(key_string, &key_base64); 67 base::Base64Encode(key_string, &key_base64);
68 key_pair_ = RsaKeyPair::FromString(key_base64); 68 key_pair_ = RsaKeyPair::FromString(key_base64);
69 ASSERT_TRUE(key_pair_.get()); 69 ASSERT_TRUE(key_pair_.get());
70 } 70 }
71 71
72 void RunChannelAuth(bool expected_fail) { 72 void RunChannelAuth(bool expected_fail) {
73 client_fake_socket_.reset(new FakeSocket()); 73 client_fake_socket_.reset(new FakeSocket());
74 host_fake_socket_.reset(new FakeSocket()); 74 host_fake_socket_.reset(new FakeSocket());
75 client_fake_socket_->PairWith(host_fake_socket_.get()); 75 client_fake_socket_->PairWith(host_fake_socket_.get());
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 host_auth_ = SslHmacChannelAuthenticator::CreateForHost( 164 host_auth_ = SslHmacChannelAuthenticator::CreateForHost(
165 host_cert_, key_pair_, kTestSharedSecret); 165 host_cert_, key_pair_, kTestSharedSecret);
166 166
167 RunChannelAuth(true); 167 RunChannelAuth(true);
168 168
169 ASSERT_TRUE(host_socket_.get() == NULL); 169 ASSERT_TRUE(host_socket_.get() == NULL);
170 } 170 }
171 171
172 } // namespace protocol 172 } // namespace protocol
173 } // namespace remoting 173 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/authenticator_test_base.cc ('k') | sandbox/win/src/handle_inheritance_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698