| 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/test/histogram_tester.h" | 8 #include "base/test/histogram_tester.h" |
| 9 #include "chrome/browser/predictors/loading_test_util.h" | 9 #include "chrome/browser/predictors/loading_test_util.h" |
| 10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
| 11 #include "content/public/test/test_browser_thread_bundle.h" | 11 #include "content/public/test/test_browser_thread_bundle.h" |
| 12 #include "content/public/test/test_utils.h" | 12 #include "content/public/test/test_utils.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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 internal::kResourcePrefetchPredictorPrefetchHitsCountCached, 1, 1); | 197 internal::kResourcePrefetchPredictorPrefetchHitsCountCached, 1, 1); |
| 200 histogram_tester_->ExpectUniqueSample( | 198 histogram_tester_->ExpectUniqueSample( |
| 201 internal::kResourcePrefetchPredictorPrefetchHitsCountNotCached, 1, 1); | 199 internal::kResourcePrefetchPredictorPrefetchHitsCountNotCached, 1, 1); |
| 202 histogram_tester_->ExpectUniqueSample( | 200 histogram_tester_->ExpectUniqueSample( |
| 203 internal::kResourcePrefetchPredictorPrefetchHitsSize, 50, 1); | 201 internal::kResourcePrefetchPredictorPrefetchHitsSize, 50, 1); |
| 204 histogram_tester_->ExpectUniqueSample( | 202 histogram_tester_->ExpectUniqueSample( |
| 205 internal::kResourcePrefetchPredictorPrefetchMissesSize, 5, 1); | 203 internal::kResourcePrefetchPredictorPrefetchMissesSize, 5, 1); |
| 206 } | 204 } |
| 207 | 205 |
| 208 } // namespace predictors | 206 } // namespace predictors |
| OLD | NEW |