| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/precache/content/precache_manager.h" | 5 #include "components/precache/content/precache_manager.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 ACTION_P(ReturnHosts, starting_hosts) { | 99 ACTION_P(ReturnHosts, starting_hosts) { |
| 100 arg1.Run(starting_hosts); | 100 arg1.Run(starting_hosts); |
| 101 } | 101 } |
| 102 | 102 |
| 103 class TestPrecacheCompletionCallback { | 103 class TestPrecacheCompletionCallback { |
| 104 public: | 104 public: |
| 105 TestPrecacheCompletionCallback() : was_on_done_called_(false) {} | 105 TestPrecacheCompletionCallback() : was_on_done_called_(false) {} |
| 106 | 106 |
| 107 void OnDone() { | 107 void OnDone(bool precaching_started) { was_on_done_called_ = true; } |
| 108 was_on_done_called_ = true; | |
| 109 } | |
| 110 | 108 |
| 111 PrecacheManager::PrecacheCompletionCallback GetCallback() { | 109 PrecacheManager::PrecacheCompletionCallback GetCallback() { |
| 112 return base::Bind(&TestPrecacheCompletionCallback::OnDone, | 110 return base::Bind(&TestPrecacheCompletionCallback::OnDone, |
| 113 base::Unretained(this)); | 111 base::Unretained(this)); |
| 114 } | 112 } |
| 115 | 113 |
| 116 bool was_on_done_called() const { | 114 bool was_on_done_called() const { |
| 117 return was_on_done_called_; | 115 return was_on_done_called_; |
| 118 } | 116 } |
| 119 | 117 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 kCurrentTime, 1000, true); | 368 kCurrentTime, 1000, true); |
| 371 expected_histogram_count_map["Precache.Saved"] += 2; | 369 expected_histogram_count_map["Precache.Saved"] += 2; |
| 372 | 370 |
| 373 base::MessageLoop::current()->RunUntilIdle(); | 371 base::MessageLoop::current()->RunUntilIdle(); |
| 374 EXPECT_EQ(expected_histogram_count_map, GetHistogramCountMap()); | 372 EXPECT_EQ(expected_histogram_count_map, GetHistogramCountMap()); |
| 375 } | 373 } |
| 376 | 374 |
| 377 } // namespace | 375 } // namespace |
| 378 | 376 |
| 379 } // namespace precache | 377 } // namespace precache |
| OLD | NEW |