| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/sessions/session_restore_stats_collector.h" | 5 #include "chrome/browser/sessions/session_restore_stats_collector.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 stats_collector_->DeferTab(controller); | 289 stats_collector_->DeferTab(controller); |
| 290 } | 290 } |
| 291 | 291 |
| 292 // Inputs to the stats collector. Reset prior to each test. | 292 // Inputs to the stats collector. Reset prior to each test. |
| 293 base::SimpleTestTickClock* test_tick_clock_; | 293 base::SimpleTestTickClock* test_tick_clock_; |
| 294 std::vector<RestoredTab> restored_tabs_; | 294 std::vector<RestoredTab> restored_tabs_; |
| 295 | 295 |
| 296 // Infrastructure needed for using the TestWebContentsFactory. These are | 296 // Infrastructure needed for using the TestWebContentsFactory. These are |
| 297 // initialized once by the fixture and reused across unittests. | 297 // initialized once by the fixture and reused across unittests. |
| 298 base::MessageLoop message_loop_; | 298 base::MessageLoop message_loop_; |
| 299 content::TestBrowserThread ui_thread_; |
| 300 // |ui_thread_| needs to still be alive when |testing_profile_| is destroyed. |
| 299 TestingProfile testing_profile_; | 301 TestingProfile testing_profile_; |
| 300 content::TestBrowserThread ui_thread_; | |
| 301 | 302 |
| 302 // A new web contents factory is generated per test. This automatically cleans | 303 // A new web contents factory is generated per test. This automatically cleans |
| 303 // up any tabs created by previous tests. | 304 // up any tabs created by previous tests. |
| 304 std::unique_ptr<content::TestWebContentsFactory> test_web_contents_factory_; | 305 std::unique_ptr<content::TestWebContentsFactory> test_web_contents_factory_; |
| 305 | 306 |
| 306 // These are recreated for each test. The reporting delegate allows the test | 307 // These are recreated for each test. The reporting delegate allows the test |
| 307 // to observe the behaviour of the SessionRestoreStatsCollector under test. | 308 // to observe the behaviour of the SessionRestoreStatsCollector under test. |
| 308 PassthroughStatsReportingDelegate* passthrough_reporting_delegate_; | 309 PassthroughStatsReportingDelegate* passthrough_reporting_delegate_; |
| 309 TestSessionRestoreStatsCollector* stats_collector_; | 310 TestSessionRestoreStatsCollector* stats_collector_; |
| 310 | 311 |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 mock_reporting_delegate.ExpectReportTabLoaderStatsCalled(2, 1, 1, 0, 0, 0, 0, | 632 mock_reporting_delegate.ExpectReportTabLoaderStatsCalled(2, 1, 1, 0, 0, 0, 0, |
| 632 1); | 633 1); |
| 633 mock_reporting_delegate.EnsureNoUnexpectedCalls(); | 634 mock_reporting_delegate.EnsureNoUnexpectedCalls(); |
| 634 | 635 |
| 635 // Destroy the background tab. The collector should release itself. | 636 // Destroy the background tab. The collector should release itself. |
| 636 Tick(); // 3 ms. | 637 Tick(); // 3 ms. |
| 637 GenerateWebContentsDestroyed(1); | 638 GenerateWebContentsDestroyed(1); |
| 638 mock_reporting_delegate.ExpectReportStatsCollectorDeathCalled(); | 639 mock_reporting_delegate.ExpectReportStatsCollectorDeathCalled(); |
| 639 mock_reporting_delegate.EnsureNoUnexpectedCalls(); | 640 mock_reporting_delegate.EnsureNoUnexpectedCalls(); |
| 640 } | 641 } |
| OLD | NEW |