OLD | NEW |
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 EXPECT_TRUE(trans.get() != NULL); | 50 EXPECT_TRUE(trans.get() != NULL); |
51 } | 51 } |
52 | 52 |
53 TEST_F(HttpNetworkLayerTest, Suspend) { | 53 TEST_F(HttpNetworkLayerTest, Suspend) { |
54 scoped_ptr<HttpTransaction> trans; | 54 scoped_ptr<HttpTransaction> trans; |
55 int rv = factory_->CreateTransaction(&trans); | 55 int rv = factory_->CreateTransaction(&trans); |
56 EXPECT_EQ(OK, rv); | 56 EXPECT_EQ(OK, rv); |
57 | 57 |
58 trans.reset(); | 58 trans.reset(); |
59 | 59 |
60 factory_->Suspend(true); | 60 factory_->OnSuspend(); |
61 | 61 |
62 rv = factory_->CreateTransaction(&trans); | 62 rv = factory_->CreateTransaction(&trans); |
63 EXPECT_EQ(ERR_NETWORK_IO_SUSPENDED, rv); | 63 EXPECT_EQ(ERR_NETWORK_IO_SUSPENDED, rv); |
64 | 64 |
65 ASSERT_TRUE(trans == NULL); | 65 ASSERT_TRUE(trans == NULL); |
66 | 66 |
67 factory_->Suspend(false); | 67 factory_->OnResume(); |
68 | 68 |
69 rv = factory_->CreateTransaction(&trans); | 69 rv = factory_->CreateTransaction(&trans); |
70 EXPECT_EQ(OK, rv); | 70 EXPECT_EQ(OK, rv); |
71 } | 71 } |
72 | 72 |
73 TEST_F(HttpNetworkLayerTest, GET) { | 73 TEST_F(HttpNetworkLayerTest, GET) { |
74 MockRead data_reads[] = { | 74 MockRead data_reads[] = { |
75 MockRead("HTTP/1.0 200 OK\r\n\r\n"), | 75 MockRead("HTTP/1.0 200 OK\r\n\r\n"), |
76 MockRead("hello world"), | 76 MockRead("hello world"), |
77 MockRead(false, OK), | 77 MockRead(false, OK), |
(...skipping 28 matching lines...) Expand all Loading... |
106 | 106 |
107 std::string contents; | 107 std::string contents; |
108 rv = ReadTransaction(trans.get(), &contents); | 108 rv = ReadTransaction(trans.get(), &contents); |
109 EXPECT_EQ(OK, rv); | 109 EXPECT_EQ(OK, rv); |
110 EXPECT_EQ("hello world", contents); | 110 EXPECT_EQ("hello world", contents); |
111 } | 111 } |
112 | 112 |
113 } // namespace | 113 } // namespace |
114 | 114 |
115 } // namespace net | 115 } // namespace net |
OLD | NEW |