| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ios/chrome/browser/test/perf_test_with_bvc_ios.h" | 5 #include "ios/chrome/browser/test/perf_test_with_bvc_ios.h" |
| 6 | 6 |
| 7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" |
| 9 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
| 11 #include "components/bookmarks/test/bookmark_test_helpers.h" | 12 #include "components/bookmarks/test/bookmark_test_helpers.h" |
| 12 #include "ios/chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 13 #include "ios/chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
| 13 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" | 14 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" |
| 15 #include "ios/chrome/browser/browser_state/test_chrome_browser_state_manager.h" |
| 14 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" | 16 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" |
| 15 #import "ios/chrome/browser/sessions/session_service.h" | 17 #import "ios/chrome/browser/sessions/session_service.h" |
| 16 #import "ios/chrome/browser/sessions/session_window.h" | 18 #import "ios/chrome/browser/sessions/session_window.h" |
| 17 #import "ios/chrome/browser/tabs/tab_model.h" | 19 #import "ios/chrome/browser/tabs/tab_model.h" |
| 18 #import "ios/chrome/browser/ui/browser_view_controller.h" | 20 #import "ios/chrome/browser/ui/browser_view_controller.h" |
| 19 #import "ios/chrome/browser/ui/browser_view_controller_dependency_factory.h" | 21 #import "ios/chrome/browser/ui/browser_view_controller_dependency_factory.h" |
| 20 #import "ios/chrome/browser/ui/preload_controller.h" | 22 #import "ios/chrome/browser/ui/preload_controller.h" |
| 21 #import "ios/chrome/browser/web/chrome_web_client.h" | 23 #import "ios/chrome/browser/web/chrome_web_client.h" |
| 22 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 24 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
| 23 | 25 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 @implementation TestBVCDependencyFactory | 61 @implementation TestBVCDependencyFactory |
| 60 - (PreloadController*)newPreloadController { | 62 - (PreloadController*)newPreloadController { |
| 61 return [[TestPreloadController alloc] init]; | 63 return [[TestPreloadController alloc] init]; |
| 62 } | 64 } |
| 63 @end | 65 @end |
| 64 | 66 |
| 65 PerfTestWithBVC::PerfTestWithBVC(std::string testGroup) | 67 PerfTestWithBVC::PerfTestWithBVC(std::string testGroup) |
| 66 : PerfTest(testGroup), | 68 : PerfTest(testGroup), |
| 67 slow_teardown_(false), | 69 slow_teardown_(false), |
| 68 web_client_(base::MakeUnique<ChromeWebClient>()), | 70 web_client_(base::MakeUnique<ChromeWebClient>()), |
| 69 provider_(ios::CreateChromeBrowserProvider()) {} | 71 provider_(ios::CreateChromeBrowserProvider()), |
| 72 browser_state_manager_( |
| 73 base::MakeUnique<TestChromeBrowserStateManager>(base::FilePath())) {} |
| 70 | 74 |
| 71 PerfTestWithBVC::PerfTestWithBVC(std::string testGroup, | 75 PerfTestWithBVC::PerfTestWithBVC(std::string testGroup, |
| 72 std::string firstLabel, | 76 std::string firstLabel, |
| 73 std::string averageLabel, | 77 std::string averageLabel, |
| 74 bool isWaterfall, | 78 bool isWaterfall, |
| 75 bool verbose, | 79 bool verbose, |
| 76 bool slowTeardown, | 80 bool slowTeardown, |
| 77 int repeat) | 81 int repeat) |
| 78 : PerfTest(testGroup, | 82 : PerfTest(testGroup, |
| 79 firstLabel, | 83 firstLabel, |
| 80 averageLabel, | 84 averageLabel, |
| 81 isWaterfall, | 85 isWaterfall, |
| 82 verbose, | 86 verbose, |
| 83 repeat), | 87 repeat), |
| 84 slow_teardown_(slowTeardown), | 88 slow_teardown_(slowTeardown), |
| 85 web_client_(base::MakeUnique<ChromeWebClient>()), | 89 web_client_(base::MakeUnique<ChromeWebClient>()), |
| 86 provider_(ios::CreateChromeBrowserProvider()) {} | 90 provider_(ios::CreateChromeBrowserProvider()), |
| 91 browser_state_manager_( |
| 92 base::MakeUnique<TestChromeBrowserStateManager>(base::FilePath())) {} |
| 87 | 93 |
| 88 PerfTestWithBVC::~PerfTestWithBVC() {} | 94 PerfTestWithBVC::~PerfTestWithBVC() {} |
| 89 | 95 |
| 90 void PerfTestWithBVC::SetUp() { | 96 void PerfTestWithBVC::SetUp() { |
| 91 PerfTest::SetUp(); | 97 PerfTest::SetUp(); |
| 92 | 98 |
| 93 // Set up the ChromeBrowserState instances. | 99 // Set up the ChromeBrowserState instances. |
| 94 TestChromeBrowserState::Builder test_cbs_builder; | 100 TestChromeBrowserState::Builder test_cbs_builder; |
| 95 test_cbs_builder.AddTestingFactory( | 101 test_cbs_builder.AddTestingFactory( |
| 96 ios::TemplateURLServiceFactory::GetInstance(), | 102 ios::TemplateURLServiceFactory::GetInstance(), |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // NSAutoreleasePool can drain. This needs to be done before | 166 // NSAutoreleasePool can drain. This needs to be done before |
| 161 // |chrome_browser_state_| can be cleared. For tests that allocate more | 167 // |chrome_browser_state_| can be cleared. For tests that allocate more |
| 162 // objects, more runloop time may be required. | 168 // objects, more runloop time may be required. |
| 163 if (slow_teardown_) | 169 if (slow_teardown_) |
| 164 SpinRunLoop(.5); | 170 SpinRunLoop(.5); |
| 165 PerfTest::TearDown(); | 171 PerfTest::TearDown(); |
| 166 | 172 |
| 167 // The profiles can be deallocated only after the BVC has been deallocated. | 173 // The profiles can be deallocated only after the BVC has been deallocated. |
| 168 chrome_browser_state_.reset(); | 174 chrome_browser_state_.reset(); |
| 169 } | 175 } |
| OLD | NEW |