| 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/files/file_path.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
| 12 #include "components/bookmarks/test/bookmark_test_helpers.h" | 12 #include "components/bookmarks/test/bookmark_test_helpers.h" |
| 13 #include "ios/chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 13 #include "ios/chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
| 14 #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" | 15 #include "ios/chrome/browser/browser_state/test_chrome_browser_state_manager.h" |
| 16 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" | 16 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" |
| 17 #import "ios/chrome/browser/sessions/session_ios.h" | 17 #import "ios/chrome/browser/sessions/session_ios.h" |
| 18 #import "ios/chrome/browser/sessions/session_service_ios.h" | 18 #import "ios/chrome/browser/sessions/session_service_ios.h" |
| 19 #import "ios/chrome/browser/sessions/session_window_ios.h" | 19 #import "ios/chrome/browser/sessions/session_window_ios.h" |
| 20 #import "ios/chrome/browser/tabs/tab_model.h" | 20 #import "ios/chrome/browser/tabs/tab_model.h" |
| 21 #import "ios/chrome/browser/ui/browser_view_controller.h" | 21 #import "ios/chrome/browser/ui/browser_view_controller.h" |
| 22 #import "ios/chrome/browser/ui/browser_view_controller_dependency_factory.h" | 22 #import "ios/chrome/browser/ui/browser_view_controller_dependency_factory.h" |
| 23 #import "ios/chrome/browser/ui/preload_controller.h" | 23 #import "ios/chrome/browser/ui/preload_controller.h" |
| 24 #import "ios/chrome/browser/web/chrome_web_client.h" | 24 #import "ios/chrome/browser/web/chrome_web_client.h" |
| 25 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 25 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
| 26 | 26 |
| 27 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 28 #error "This file requires ARC support." |
| 29 #endif |
| 30 |
| 27 // Subclass of PrerenderController so it isn't actually used. Using a mock for | 31 // Subclass of PrerenderController so it isn't actually used. Using a mock for |
| 28 // this makes cleanup on shutdown simpler, by minimizing the number of profile | 32 // this makes cleanup on shutdown simpler, by minimizing the number of profile |
| 29 // observers registered with the profiles. The profile observers have to be | 33 // observers registered with the profiles. The profile observers have to be |
| 30 // deallocated before the profiles themselves, but in practice it is very hard | 34 // deallocated before the profiles themselves, but in practice it is very hard |
| 31 // to ensure that happens. Also, for performance testing, not having the | 35 // to ensure that happens. Also, for performance testing, not having the |
| 32 // PrerenderController makes the test far simpler to analyze. | 36 // PrerenderController makes the test far simpler to analyze. |
| 33 namespace { | 37 namespace { |
| 34 static GURL emptyGurl_ = GURL("foo", 3, url::Parsed(), false); | 38 static GURL emptyGurl_ = GURL("foo", 3, url::Parsed(), false); |
| 35 } | 39 } |
| 36 | 40 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 // NSAutoreleasePool can drain. This needs to be done before | 174 // NSAutoreleasePool can drain. This needs to be done before |
| 171 // |chrome_browser_state_| can be cleared. For tests that allocate more | 175 // |chrome_browser_state_| can be cleared. For tests that allocate more |
| 172 // objects, more runloop time may be required. | 176 // objects, more runloop time may be required. |
| 173 if (slow_teardown_) | 177 if (slow_teardown_) |
| 174 SpinRunLoop(.5); | 178 SpinRunLoop(.5); |
| 175 PerfTest::TearDown(); | 179 PerfTest::TearDown(); |
| 176 | 180 |
| 177 // The profiles can be deallocated only after the BVC has been deallocated. | 181 // The profiles can be deallocated only after the BVC has been deallocated. |
| 178 chrome_browser_state_.reset(); | 182 chrome_browser_state_.reset(); |
| 179 } | 183 } |
| OLD | NEW |