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

Side by Side Diff: net/socket/ssl_server_socket_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
« no previous file with comments | « net/socket/ssl_client_socket_openssl_unittest.cc ('k') | net/socket/tcp_client_socket.cc » ('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 // This test suite uses SSLClientSocket to test the implementation of 5 // This test suite uses SSLClientSocket to test the implementation of
6 // SSLServerSocket. In order to establish connections between the sockets 6 // SSLServerSocket. In order to establish connections between the sockets
7 // we need two additional classes: 7 // we need two additional classes:
8 // 1. FakeSocket 8 // 1. FakeSocket
9 // Connects SSL socket to FakeDataChannel. This class is just a stub. 9 // Connects SSL socket to FakeDataChannel. This class is just a stub.
10 // 10 //
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 scoped_ptr<ClientSocketHandle> client_connection(new ClientSocketHandle); 307 scoped_ptr<ClientSocketHandle> client_connection(new ClientSocketHandle);
308 client_connection->SetSocket( 308 client_connection->SetSocket(
309 scoped_ptr<StreamSocket>(new FakeSocket(&channel_1_, &channel_2_))); 309 scoped_ptr<StreamSocket>(new FakeSocket(&channel_1_, &channel_2_)));
310 scoped_ptr<StreamSocket> server_socket( 310 scoped_ptr<StreamSocket> server_socket(
311 new FakeSocket(&channel_2_, &channel_1_)); 311 new FakeSocket(&channel_2_, &channel_1_));
312 312
313 base::FilePath certs_dir(GetTestCertsDirectory()); 313 base::FilePath certs_dir(GetTestCertsDirectory());
314 314
315 base::FilePath cert_path = certs_dir.AppendASCII("unittest.selfsigned.der"); 315 base::FilePath cert_path = certs_dir.AppendASCII("unittest.selfsigned.der");
316 std::string cert_der; 316 std::string cert_der;
317 ASSERT_TRUE(file_util::ReadFileToString(cert_path, &cert_der)); 317 ASSERT_TRUE(base::ReadFileToString(cert_path, &cert_der));
318 318
319 scoped_refptr<net::X509Certificate> cert = 319 scoped_refptr<net::X509Certificate> cert =
320 X509Certificate::CreateFromBytes(cert_der.data(), cert_der.size()); 320 X509Certificate::CreateFromBytes(cert_der.data(), cert_der.size());
321 321
322 base::FilePath key_path = certs_dir.AppendASCII("unittest.key.bin"); 322 base::FilePath key_path = certs_dir.AppendASCII("unittest.key.bin");
323 std::string key_string; 323 std::string key_string;
324 ASSERT_TRUE(file_util::ReadFileToString(key_path, &key_string)); 324 ASSERT_TRUE(base::ReadFileToString(key_path, &key_string));
325 std::vector<uint8> key_vector( 325 std::vector<uint8> key_vector(
326 reinterpret_cast<const uint8*>(key_string.data()), 326 reinterpret_cast<const uint8*>(key_string.data()),
327 reinterpret_cast<const uint8*>(key_string.data() + 327 reinterpret_cast<const uint8*>(key_string.data() +
328 key_string.length())); 328 key_string.length()));
329 329
330 scoped_ptr<crypto::RSAPrivateKey> private_key( 330 scoped_ptr<crypto::RSAPrivateKey> private_key(
331 crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_vector)); 331 crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_vector));
332 332
333 net::SSLConfig ssl_config; 333 net::SSLConfig ssl_config;
334 ssl_config.cached_info_enabled = false; 334 ssl_config.cached_info_enabled = false;
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 unsigned char client_bad[kKeyingMaterialSize]; 579 unsigned char client_bad[kKeyingMaterialSize];
580 rv = client_socket_->ExportKeyingMaterial(kKeyingLabelBad, 580 rv = client_socket_->ExportKeyingMaterial(kKeyingLabelBad,
581 false, kKeyingContext, 581 false, kKeyingContext,
582 client_bad, sizeof(client_bad)); 582 client_bad, sizeof(client_bad));
583 ASSERT_EQ(rv, net::OK); 583 ASSERT_EQ(rv, net::OK);
584 EXPECT_NE(0, memcmp(server_out, client_bad, sizeof(server_out))); 584 EXPECT_NE(0, memcmp(server_out, client_bad, sizeof(server_out)));
585 } 585 }
586 #endif 586 #endif
587 587
588 } // namespace net 588 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_openssl_unittest.cc ('k') | net/socket/tcp_client_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698