| 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/http/http_cache.h" | 5 #include "net/http/http_cache.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 virtual void OnCacheActionStart() { | 73 virtual void OnCacheActionStart() { |
| 74 EXPECT_FALSE(action_in_progress_); | 74 EXPECT_FALSE(action_in_progress_); |
| 75 EXPECT_GT(num_remaining_actions_to_observe_, 0); | 75 EXPECT_GT(num_remaining_actions_to_observe_, 0); |
| 76 num_remaining_actions_to_observe_--; | 76 num_remaining_actions_to_observe_--; |
| 77 action_in_progress_ = true; | 77 action_in_progress_ = true; |
| 78 } | 78 } |
| 79 virtual void OnCacheActionFinish() { | 79 virtual void OnCacheActionFinish() { |
| 80 EXPECT_TRUE(action_in_progress_); | 80 EXPECT_TRUE(action_in_progress_); |
| 81 action_in_progress_ = false; | 81 action_in_progress_ = false; |
| 82 } | 82 } |
| 83 virtual void OnNetworkActionStart() {} |
| 84 virtual void OnNetworkActionFinish() {} |
| 83 | 85 |
| 84 private: | 86 private: |
| 85 int num_remaining_actions_to_observe_; | 87 int num_remaining_actions_to_observe_; |
| 86 bool action_in_progress_; | 88 bool action_in_progress_; |
| 87 }; | 89 }; |
| 88 | 90 |
| 89 void ReadAndVerifyTransaction(net::HttpTransaction* trans, | 91 void ReadAndVerifyTransaction(net::HttpTransaction* trans, |
| 90 const MockTransaction& trans_info) { | 92 const MockTransaction& trans_info) { |
| 91 std::string content; | 93 std::string content; |
| 92 int rv = ReadTransaction(trans, &content); | 94 int rv = ReadTransaction(trans, &content); |
| (...skipping 4933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5026 8); | 5028 8); |
| 5027 | 5029 |
| 5028 // Force this transaction to read from the cache. | 5030 // Force this transaction to read from the cache. |
| 5029 MockTransaction transaction(kSimpleGET_Transaction); | 5031 MockTransaction transaction(kSimpleGET_Transaction); |
| 5030 transaction.load_flags |= net::LOAD_ONLY_FROM_CACHE; | 5032 transaction.load_flags |= net::LOAD_ONLY_FROM_CACHE; |
| 5031 | 5033 |
| 5032 RunTransactionTestWithDelegate(cache.http_cache(), | 5034 RunTransactionTestWithDelegate(cache.http_cache(), |
| 5033 kSimpleGET_Transaction, | 5035 kSimpleGET_Transaction, |
| 5034 5); | 5036 5); |
| 5035 } | 5037 } |
| OLD | NEW |