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

Side by Side Diff: chrome/browser/net/http_pipelining_compatibility_client_unittest.cc

Issue 10779040: Initialize StatisticsRecorder in Child Process to hold (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 "chrome/browser/net/http_pipelining_compatibility_client.h" 5 #include "chrome/browser/net/http_pipelining_compatibility_client.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 HttpPipeliningCompatibilityClientTest() 78 HttpPipeliningCompatibilityClientTest()
79 : test_server_( 79 : test_server_(
80 net::TestServer::TYPE_HTTP, 80 net::TestServer::TYPE_HTTP,
81 net::TestServer::kLocalhost, 81 net::TestServer::kLocalhost,
82 FilePath(FILE_PATH_LITERAL("chrome/test/data/http_pipelining"))), 82 FilePath(FILE_PATH_LITERAL("chrome/test/data/http_pipelining"))),
83 io_thread_(BrowserThread::IO, &message_loop_) { 83 io_thread_(BrowserThread::IO, &message_loop_) {
84 } 84 }
85 85
86 protected: 86 protected:
87 virtual void SetUp() OVERRIDE { 87 virtual void SetUp() OVERRIDE {
88 // Start up a histogram recorder.
89 // TODO(rtenneti): Leaks StatisticsRecorder and will update suppressions.
90 base::StatisticsRecorder::Initialize();
88 ASSERT_TRUE(test_server_.Start()); 91 ASSERT_TRUE(test_server_.Start());
89 context_ = new TestURLRequestContextGetter( 92 context_ = new TestURLRequestContextGetter(
90 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 93 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
91 context_->AddRef(); 94 context_->AddRef();
92 95
93 for (size_t i = 0; i < arraysize(kHistogramNames); ++i) { 96 for (size_t i = 0; i < arraysize(kHistogramNames); ++i) {
94 const char* name = kHistogramNames[i]; 97 const char* name = kHistogramNames[i];
95 base::Histogram::SampleSet sample = GetHistogram(name); 98 base::Histogram::SampleSet sample = GetHistogram(name);
96 if (sample.TotalCount() > 0) { 99 if (sample.TotalCount() > 0) {
97 original_samples_[name] = sample; 100 original_samples_[name] = sample;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 histograms_[name] = current_histogram; 221 histograms_[name] = current_histogram;
219 } else if (cached_histogram) { 222 } else if (cached_histogram) {
220 cached_histogram->SnapshotSample(&sample); 223 cached_histogram->SnapshotSample(&sample);
221 } 224 }
222 return sample; 225 return sample;
223 } 226 }
224 227
225 static std::map<std::string, base::Histogram*> histograms_; 228 static std::map<std::string, base::Histogram*> histograms_;
226 std::map<std::string, base::Histogram::SampleSet> samples_; 229 std::map<std::string, base::Histogram::SampleSet> samples_;
227 std::map<std::string, base::Histogram::SampleSet> original_samples_; 230 std::map<std::string, base::Histogram::SampleSet> original_samples_;
228 base::StatisticsRecorder recorder_;
229 }; 231 };
230 232
231 // static 233 // static
232 std::map<std::string, base::Histogram*> 234 std::map<std::string, base::Histogram*>
233 HttpPipeliningCompatibilityClientTest::histograms_; 235 HttpPipeliningCompatibilityClientTest::histograms_;
234 236
235 TEST_F(HttpPipeliningCompatibilityClientTest, Success) { 237 TEST_F(HttpPipeliningCompatibilityClientTest, Success) {
236 RequestInfo info; 238 RequestInfo info;
237 info.filename = "files/alphabet.txt"; 239 info.filename = "files/alphabet.txt";
238 info.expected_response = "abcdefghijklmnopqrstuvwxyz"; 240 info.expected_response = "abcdefghijklmnopqrstuvwxyz";
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 callback.WaitForResult(); 556 callback.WaitForResult();
555 557
556 ExpectHistogramCount(1, false, FIELD_CANARY); 558 ExpectHistogramCount(1, false, FIELD_CANARY);
557 ExpectHistogramCount(0, false, FIELD_SUCCESS); 559 ExpectHistogramCount(0, false, FIELD_SUCCESS);
558 ExpectHistogramCount(0, true, FIELD_SUCCESS); 560 ExpectHistogramCount(0, true, FIELD_SUCCESS);
559 } 561 }
560 562
561 } // anonymous namespace 563 } // anonymous namespace
562 564
563 } // namespace chrome_browser_net 565 } // namespace chrome_browser_net
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_application_mac_unittest.mm ('k') | chrome_frame/metrics_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698