| OLD | NEW |
| 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/url_request/url_request_job.h" | 5 #include "net/url_request/url_request_job.h" |
| 6 | 6 |
| 7 #include "net/http/http_transaction_unittest.h" | 7 #include "net/http/http_transaction_unittest.h" |
| 8 #include "net/url_request/url_request_test_util.h" | 8 #include "net/url_request/url_request_test_util.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 "", | 33 "", |
| 34 TEST_MODE_NORMAL, | 34 TEST_MODE_NORMAL, |
| 35 &GZipServer, | 35 &GZipServer, |
| 36 0 | 36 0 |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 } // namespace | 39 } // namespace |
| 40 | 40 |
| 41 TEST(URLRequestJob, TransactionNotifiedWhenDone) { | 41 TEST(URLRequestJob, TransactionNotifiedWhenDone) { |
| 42 MockNetworkLayer network_layer; | 42 MockNetworkLayer network_layer; |
| 43 net::TestURLRequestContext context; | 43 TestURLRequestContext context; |
| 44 context.set_http_transaction_factory(&network_layer); | 44 context.set_http_transaction_factory(&network_layer); |
| 45 | 45 |
| 46 net::TestDelegate d; | 46 TestDelegate d; |
| 47 net::TestURLRequest req(GURL(kGZip_Transaction.url), &d, &context); | 47 TestURLRequest req(GURL(kGZip_Transaction.url), &d, &context); |
| 48 AddMockTransaction(&kGZip_Transaction); | 48 AddMockTransaction(&kGZip_Transaction); |
| 49 | 49 |
| 50 req.set_method("GET"); | 50 req.set_method("GET"); |
| 51 req.Start(); | 51 req.Start(); |
| 52 | 52 |
| 53 MessageLoop::current()->Run(); | 53 MessageLoop::current()->Run(); |
| 54 | 54 |
| 55 EXPECT_TRUE(network_layer.done_reading_called()); | 55 EXPECT_TRUE(network_layer.done_reading_called()); |
| 56 | 56 |
| 57 RemoveMockTransaction(&kGZip_Transaction); | 57 RemoveMockTransaction(&kGZip_Transaction); |
| 58 } | 58 } |
| 59 | 59 |
| 60 TEST(URLRequestJob, SyncTransactionNotifiedWhenDone) { | 60 TEST(URLRequestJob, SyncTransactionNotifiedWhenDone) { |
| 61 MockNetworkLayer network_layer; | 61 MockNetworkLayer network_layer; |
| 62 net::TestURLRequestContext context; | 62 TestURLRequestContext context; |
| 63 context.set_http_transaction_factory(&network_layer); | 63 context.set_http_transaction_factory(&network_layer); |
| 64 | 64 |
| 65 net::TestDelegate d; | 65 TestDelegate d; |
| 66 net::TestURLRequest req(GURL(kGZip_Transaction.url), &d, &context); | 66 TestURLRequest req(GURL(kGZip_Transaction.url), &d, &context); |
| 67 MockTransaction transaction(kGZip_Transaction); | 67 MockTransaction transaction(kGZip_Transaction); |
| 68 transaction.test_mode = TEST_MODE_SYNC_ALL; | 68 transaction.test_mode = TEST_MODE_SYNC_ALL; |
| 69 AddMockTransaction(&transaction); | 69 AddMockTransaction(&transaction); |
| 70 | 70 |
| 71 req.set_method("GET"); | 71 req.set_method("GET"); |
| 72 req.Start(); | 72 req.Start(); |
| 73 | 73 |
| 74 MessageLoop::current()->Run(); | 74 MessageLoop::current()->Run(); |
| 75 | 75 |
| 76 EXPECT_TRUE(network_layer.done_reading_called()); | 76 EXPECT_TRUE(network_layer.done_reading_called()); |
| 77 | 77 |
| 78 RemoveMockTransaction(&transaction); | 78 RemoveMockTransaction(&transaction); |
| 79 } | 79 } |
| OLD | NEW |