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

Side by Side Diff: net/http/http_network_layer_unittest.cc

Issue 9425016: Change MockRead and MockWrite (et. al.) to take an IoMode enum, instead (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: sync Created 8 years, 10 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "net/base/cert_verifier.h" 5 #include "net/base/cert_verifier.h"
6 #include "net/base/mock_host_resolver.h" 6 #include "net/base/mock_host_resolver.h"
7 #include "net/base/net_log.h" 7 #include "net/base/net_log.h"
8 #include "net/base/ssl_config_service_defaults.h" 8 #include "net/base/ssl_config_service_defaults.h"
9 #include "net/http/http_network_layer.h" 9 #include "net/http/http_network_layer.h"
10 #include "net/http/http_network_session.h" 10 #include "net/http/http_network_session.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 factory_->OnResume(); 70 factory_->OnResume();
71 71
72 rv = factory_->CreateTransaction(&trans); 72 rv = factory_->CreateTransaction(&trans);
73 EXPECT_EQ(OK, rv); 73 EXPECT_EQ(OK, rv);
74 } 74 }
75 75
76 TEST_F(HttpNetworkLayerTest, GET) { 76 TEST_F(HttpNetworkLayerTest, GET) {
77 MockRead data_reads[] = { 77 MockRead data_reads[] = {
78 MockRead("HTTP/1.0 200 OK\r\n\r\n"), 78 MockRead("HTTP/1.0 200 OK\r\n\r\n"),
79 MockRead("hello world"), 79 MockRead("hello world"),
80 MockRead(false, OK), 80 MockRead(SYNCHRONOUS, OK),
81 }; 81 };
82 MockWrite data_writes[] = { 82 MockWrite data_writes[] = {
83 MockWrite("GET / HTTP/1.1\r\n" 83 MockWrite("GET / HTTP/1.1\r\n"
84 "Host: www.google.com\r\n" 84 "Host: www.google.com\r\n"
85 "Connection: keep-alive\r\n" 85 "Connection: keep-alive\r\n"
86 "User-Agent: Foo/1.0\r\n\r\n"), 86 "User-Agent: Foo/1.0\r\n\r\n"),
87 }; 87 };
88 StaticSocketDataProvider data(data_reads, arraysize(data_reads), 88 StaticSocketDataProvider data(data_reads, arraysize(data_reads),
89 data_writes, arraysize(data_writes)); 89 data_writes, arraysize(data_writes));
90 mock_socket_factory_.AddSocketDataProvider(&data); 90 mock_socket_factory_.AddSocketDataProvider(&data);
(...skipping 18 matching lines...) Expand all
109 109
110 std::string contents; 110 std::string contents;
111 rv = ReadTransaction(trans.get(), &contents); 111 rv = ReadTransaction(trans.get(), &contents);
112 EXPECT_EQ(OK, rv); 112 EXPECT_EQ(OK, rv);
113 EXPECT_EQ("hello world", contents); 113 EXPECT_EQ("hello world", contents);
114 } 114 }
115 115
116 } // namespace 116 } // namespace
117 117
118 } // namespace net 118 } // namespace net
OLDNEW
« no previous file with comments | « net/ftp/ftp_network_transaction_unittest.cc ('k') | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698