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

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

Issue 11572039: Make HttpNetworkLayer subscribe to power events on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 "net/http/http_network_layer.h" 5 #include "net/http/http_network_layer.h"
6 6
7 #include "net/base/mock_cert_verifier.h" 7 #include "net/base/mock_cert_verifier.h"
8 #include "net/base/mock_host_resolver.h" 8 #include "net/base/mock_host_resolver.h"
9 #include "net/base/net_log.h" 9 #include "net/base/net_log.h"
10 #include "net/base/ssl_config_service_defaults.h" 10 #include "net/base/ssl_config_service_defaults.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 HttpServerPropertiesImpl http_server_properties_; 53 HttpServerPropertiesImpl http_server_properties_;
54 }; 54 };
55 55
56 TEST_F(HttpNetworkLayerTest, CreateAndDestroy) { 56 TEST_F(HttpNetworkLayerTest, CreateAndDestroy) {
57 scoped_ptr<HttpTransaction> trans; 57 scoped_ptr<HttpTransaction> trans;
58 int rv = factory_->CreateTransaction(&trans, NULL); 58 int rv = factory_->CreateTransaction(&trans, NULL);
59 EXPECT_EQ(OK, rv); 59 EXPECT_EQ(OK, rv);
60 EXPECT_TRUE(trans.get() != NULL); 60 EXPECT_TRUE(trans.get() != NULL);
61 } 61 }
62 62
63 TEST_F(HttpNetworkLayerTest, Suspend) {
64 scoped_ptr<HttpTransaction> trans;
65 int rv = factory_->CreateTransaction(&trans, NULL);
66 EXPECT_EQ(OK, rv);
67
68 trans.reset();
69
70 factory_->OnSuspend();
71
72 rv = factory_->CreateTransaction(&trans, NULL);
73 EXPECT_EQ(ERR_NETWORK_IO_SUSPENDED, rv);
74
75 ASSERT_TRUE(trans == NULL);
76
77 factory_->OnResume();
78
79 rv = factory_->CreateTransaction(&trans, NULL);
80 EXPECT_EQ(OK, rv);
81 }
82
83 TEST_F(HttpNetworkLayerTest, GET) { 63 TEST_F(HttpNetworkLayerTest, GET) {
84 MockRead data_reads[] = { 64 MockRead data_reads[] = {
85 MockRead("HTTP/1.0 200 OK\r\n\r\n"), 65 MockRead("HTTP/1.0 200 OK\r\n\r\n"),
86 MockRead("hello world"), 66 MockRead("hello world"),
87 MockRead(SYNCHRONOUS, OK), 67 MockRead(SYNCHRONOUS, OK),
88 }; 68 };
89 MockWrite data_writes[] = { 69 MockWrite data_writes[] = {
90 MockWrite("GET / HTTP/1.1\r\n" 70 MockWrite("GET / HTTP/1.1\r\n"
91 "Host: www.google.com\r\n" 71 "Host: www.google.com\r\n"
92 "Connection: keep-alive\r\n" 72 "Connection: keep-alive\r\n"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 EXPECT_EQ(OK, rv); 266 EXPECT_EQ(OK, rv);
287 EXPECT_EQ("Bypass message", contents); 267 EXPECT_EQ("Bypass message", contents);
288 268
289 // We should have no entries in our bad proxy list. 269 // We should have no entries in our bad proxy list.
290 ASSERT_EQ(0u, proxy_service_->proxy_retry_info().size()); 270 ASSERT_EQ(0u, proxy_service_->proxy_retry_info().size());
291 } 271 }
292 272
293 } // namespace 273 } // namespace
294 274
295 } // namespace net 275 } // namespace net
OLDNEW
« net/http/http_network_layer.h ('K') | « net/http/http_network_layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698