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

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

Issue 10834313: Add histograms for network activity, and total/cumulative (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months 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_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
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() {}
mmenke 2012/08/15 15:09:53 Should add EXPECTs for these, too.
tburkard 2012/08/15 16:50:46 Done.
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_;
mmenke 2012/08/15 15:09:53 cache_action_in_progess_?
tburkard 2012/08/15 16:50:46 Done.
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);
93 95
94 EXPECT_EQ(net::OK, rv); 96 EXPECT_EQ(net::OK, rv);
95 std::string expected(trans_info.data); 97 std::string expected(trans_info.data);
96 EXPECT_EQ(expected, content); 98 EXPECT_EQ(expected, content);
(...skipping 4929 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698