| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/predictors/loading_stats_collector.h" | 5 #include "chrome/browser/predictors/loading_stats_collector.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/test/histogram_tester.h" | 9 #include "base/test/histogram_tester.h" |
| 10 #include "chrome/browser/predictors/loading_test_util.h" | 10 #include "chrome/browser/predictors/loading_test_util.h" |
| 11 #include "chrome/test/base/testing_profile.h" | 11 #include "chrome/test/base/testing_profile.h" |
| 12 #include "content/public/test/test_browser_thread_bundle.h" | 12 #include "content/public/test/test_browser_thread_bundle.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 using testing::_; | 15 using testing::_; |
| 16 using testing::DoAll; | 16 using testing::DoAll; |
| 17 using testing::Return; | 17 using testing::Return; |
| 18 using testing::SetArgPointee; | 18 using testing::SetArgPointee; |
| 19 using testing::StrictMock; | 19 using testing::StrictMock; |
| 20 | 20 |
| 21 namespace predictors { | 21 namespace predictors { |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 const char kInitialUrl[] = "http://www.google.com/cats"; | 24 const char kInitialUrl[] = "http://www.google.com/cats"; |
| 25 const char kRedirectedUrl[] = "http://www.google.com/dogs"; | 25 const char kRedirectedUrl[] = "http://www.google.com/dogs"; |
| 26 const char kRedirectedUrl2[] = "http://www.google.com/raccoons"; | 26 const char kRedirectedUrl2[] = "http://www.google.com/raccoons"; |
| 27 } | 27 } |
| 28 | 28 |
| 29 using PageRequestSummary = ResourcePrefetchPredictor::PageRequestSummary; | |
| 30 using Prediction = ResourcePrefetchPredictor::Prediction; | 29 using Prediction = ResourcePrefetchPredictor::Prediction; |
| 31 using RedirectStatus = ResourcePrefetchPredictor::RedirectStatus; | 30 using RedirectStatus = ResourcePrefetchPredictor::RedirectStatus; |
| 32 using URLRequestSummary = ResourcePrefetchPredictor::URLRequestSummary; | |
| 33 using PrefetchedRequestStats = ResourcePrefetcher::PrefetchedRequestStats; | 31 using PrefetchedRequestStats = ResourcePrefetcher::PrefetchedRequestStats; |
| 34 using PrefetcherStats = ResourcePrefetcher::PrefetcherStats; | 32 using PrefetcherStats = ResourcePrefetcher::PrefetcherStats; |
| 35 | 33 |
| 36 class LoadingStatsCollectorTest : public testing::Test { | 34 class LoadingStatsCollectorTest : public testing::Test { |
| 37 public: | 35 public: |
| 38 LoadingStatsCollectorTest(); | 36 LoadingStatsCollectorTest(); |
| 39 ~LoadingStatsCollectorTest() override; | 37 ~LoadingStatsCollectorTest() override; |
| 40 void SetUp() override; | 38 void SetUp() override; |
| 41 void TearDown() override; | 39 void TearDown() override; |
| 42 | 40 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 internal::kResourcePrefetchPredictorPrefetchHitsCountCached, 1, 1); | 200 internal::kResourcePrefetchPredictorPrefetchHitsCountCached, 1, 1); |
| 203 histogram_tester_->ExpectUniqueSample( | 201 histogram_tester_->ExpectUniqueSample( |
| 204 internal::kResourcePrefetchPredictorPrefetchHitsCountNotCached, 1, 1); | 202 internal::kResourcePrefetchPredictorPrefetchHitsCountNotCached, 1, 1); |
| 205 histogram_tester_->ExpectUniqueSample( | 203 histogram_tester_->ExpectUniqueSample( |
| 206 internal::kResourcePrefetchPredictorPrefetchHitsSize, 50, 1); | 204 internal::kResourcePrefetchPredictorPrefetchHitsSize, 50, 1); |
| 207 histogram_tester_->ExpectUniqueSample( | 205 histogram_tester_->ExpectUniqueSample( |
| 208 internal::kResourcePrefetchPredictorPrefetchMissesSize, 5, 1); | 206 internal::kResourcePrefetchPredictorPrefetchMissesSize, 5, 1); |
| 209 } | 207 } |
| 210 | 208 |
| 211 } // namespace predictors | 209 } // namespace predictors |
| OLD | NEW |