| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 10 #include "net/base/test_completion_callback.h" | 10 #include "net/base/test_completion_callback.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 int rv = cache->CreateTransaction(DEFAULT_PRIORITY, &trans); | 57 int rv = cache->CreateTransaction(DEFAULT_PRIORITY, &trans); |
| 58 EXPECT_THAT(rv, IsOk()); | 58 EXPECT_THAT(rv, IsOk()); |
| 59 ASSERT_TRUE(trans.get()); | 59 ASSERT_TRUE(trans.get()); |
| 60 | 60 |
| 61 rv = trans->Start(&request, callback.callback(), NetLogWithSource()); | 61 rv = trans->Start(&request, callback.callback(), NetLogWithSource()); |
| 62 base::RunLoop().RunUntilIdle(); | 62 base::RunLoop().RunUntilIdle(); |
| 63 | 63 |
| 64 if (rv == ERR_IO_PENDING) | 64 if (rv == ERR_IO_PENDING) |
| 65 rv = callback.WaitForResult(); | 65 rv = callback.WaitForResult(); |
| 66 | 66 |
| 67 ASSERT_EQ(mock_trans->return_code, rv); | 67 ASSERT_EQ(mock_trans->start_return_code, rv); |
| 68 if (OK != rv) | 68 if (OK != rv) |
| 69 return; | 69 return; |
| 70 | 70 |
| 71 const HttpResponseInfo* response = trans->GetResponseInfo(); | 71 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 72 ASSERT_TRUE(response); | 72 ASSERT_TRUE(response); |
| 73 | 73 |
| 74 std::string content; | 74 std::string content; |
| 75 rv = ReadTransaction(trans.get(), &content); | 75 rv = ReadTransaction(trans.get(), &content); |
| 76 | 76 |
| 77 EXPECT_THAT(rv, IsOk()); | 77 EXPECT_THAT(rv, IsOk()); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 274 |
| 275 base::RunLoop().RunUntilIdle(); | 275 base::RunLoop().RunUntilIdle(); |
| 276 // Make sure no new net layer transaction is created. | 276 // Make sure no new net layer transaction is created. |
| 277 EXPECT_EQ(1, mock_cache.network_layer()->transaction_count()); | 277 EXPECT_EQ(1, mock_cache.network_layer()->transaction_count()); |
| 278 EXPECT_EQ(2, mock_cache.disk_cache()->open_count()); | 278 EXPECT_EQ(2, mock_cache.disk_cache()->open_count()); |
| 279 EXPECT_EQ(1, mock_cache.disk_cache()->create_count()); | 279 EXPECT_EQ(1, mock_cache.disk_cache()->create_count()); |
| 280 RemoveMockTransaction(mock_trans3.get()); | 280 RemoveMockTransaction(mock_trans3.get()); |
| 281 } | 281 } |
| 282 | 282 |
| 283 } // namespace net | 283 } // namespace net |
| OLD | NEW |