| 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" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 bookmarks::test::WaitForBookmarkModelToLoad( | 109 bookmarks::test::WaitForBookmarkModelToLoad( |
| 110 ios::BookmarkModelFactory::GetForBrowserState( | 110 ios::BookmarkModelFactory::GetForBrowserState( |
| 111 chrome_browser_state_.get())); | 111 chrome_browser_state_.get())); |
| 112 ASSERT_TRUE(chrome_browser_state_->CreateHistoryService(false)); | 112 ASSERT_TRUE(chrome_browser_state_->CreateHistoryService(false)); |
| 113 | 113 |
| 114 // Force creation of AutocompleteClassifier instance. | 114 // Force creation of AutocompleteClassifier instance. |
| 115 ios::AutocompleteClassifierFactory::GetForBrowserState( | 115 ios::AutocompleteClassifierFactory::GetForBrowserState( |
| 116 chrome_browser_state_.get()); | 116 chrome_browser_state_.get()); |
| 117 | 117 |
| 118 // Use the session to create a window which will contain the tab models. | 118 // Use the session to create a window which will contain the tab models. |
| 119 SessionWindowIOS* sessionWindow = [[SessionServiceIOS sharedService] | 119 SessionServiceIOS* session_service = [SessionServiceIOS sharedService]; |
| 120 loadWindowForBrowserState:chrome_browser_state_.get()]; | 120 NSString* state_path = base::SysUTF8ToNSString( |
| 121 chrome_browser_state_->GetStatePath().AsUTF8Unsafe()); |
| 122 NSString* session_path = [session_service sessionPathForDirectory:state_path]; |
| 123 SessionWindowIOS* sessionWindow = |
| 124 [session_service loadSessionWindowFromPath:session_path]; |
| 121 | 125 |
| 122 // Tab models. The off-the-record (OTR) tab model is required for the stack | 126 // Tab models. The off-the-record (OTR) tab model is required for the stack |
| 123 // view controller, which is created in OpenStackView(). | 127 // view controller, which is created in OpenStackView(). |
| 124 tab_model_.reset([[TabModel alloc] | 128 tab_model_.reset([[TabModel alloc] |
| 125 initWithSessionWindow:sessionWindow | 129 initWithSessionWindow:sessionWindow |
| 126 sessionService:[SessionServiceIOS sharedService] | 130 sessionService:[SessionServiceIOS sharedService] |
| 127 browserState:chrome_browser_state_.get()]); | 131 browserState:chrome_browser_state_.get()]); |
| 128 otr_tab_model_.reset([[TabModel alloc] | 132 otr_tab_model_.reset([[TabModel alloc] |
| 129 initWithSessionWindow:sessionWindow | 133 initWithSessionWindow:sessionWindow |
| 130 sessionService:[SessionServiceIOS sharedService] | 134 sessionService:[SessionServiceIOS sharedService] |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // NSAutoreleasePool can drain. This needs to be done before | 170 // NSAutoreleasePool can drain. This needs to be done before |
| 167 // |chrome_browser_state_| can be cleared. For tests that allocate more | 171 // |chrome_browser_state_| can be cleared. For tests that allocate more |
| 168 // objects, more runloop time may be required. | 172 // objects, more runloop time may be required. |
| 169 if (slow_teardown_) | 173 if (slow_teardown_) |
| 170 SpinRunLoop(.5); | 174 SpinRunLoop(.5); |
| 171 PerfTest::TearDown(); | 175 PerfTest::TearDown(); |
| 172 | 176 |
| 173 // The profiles can be deallocated only after the BVC has been deallocated. | 177 // The profiles can be deallocated only after the BVC has been deallocated. |
| 174 chrome_browser_state_.reset(); | 178 chrome_browser_state_.reset(); |
| 175 } | 179 } |
| OLD | NEW |