Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: ios/chrome/browser/test/perf_test_with_bvc_ios.mm

Issue 2810743002: [ios] Refactor SessionServiceIOS to remove dependency on BrowserState. (Closed)
Patch Set: Fix a typo in SessionServiceIOS initializer's comment. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 NSString* state_path = base::SysUTF8ToNSString(
120 loadWindowForBrowserState:chrome_browser_state_.get()]; 120 chrome_browser_state_->GetStatePath().AsUTF8Unsafe());
121 SessionWindowIOS* session_window = [[SessionServiceIOS sharedService]
122 loadSessionWindowFromDirectory:state_path];
121 123
122 // Tab models. The off-the-record (OTR) tab model is required for the stack 124 // Tab models. The off-the-record (OTR) tab model is required for the stack
123 // view controller, which is created in OpenStackView(). 125 // view controller, which is created in OpenStackView().
124 tab_model_.reset([[TabModel alloc] 126 tab_model_.reset([[TabModel alloc]
125 initWithSessionWindow:sessionWindow 127 initWithSessionWindow:session_window
126 sessionService:[SessionServiceIOS sharedService] 128 sessionService:[SessionServiceIOS sharedService]
127 browserState:chrome_browser_state_.get()]); 129 browserState:chrome_browser_state_.get()]);
128 otr_tab_model_.reset([[TabModel alloc] 130 otr_tab_model_.reset([[TabModel alloc]
129 initWithSessionWindow:sessionWindow 131 initWithSessionWindow:session_window
130 sessionService:[SessionServiceIOS sharedService] 132 sessionService:[SessionServiceIOS sharedService]
131 browserState:chrome_browser_state_ 133 browserState:chrome_browser_state_
132 ->GetOffTheRecordChromeBrowserState()]); 134 ->GetOffTheRecordChromeBrowserState()]);
133 135
134 // Create the browser view controller with its testing factory. 136 // Create the browser view controller with its testing factory.
135 bvc_factory_.reset([[TestBVCDependencyFactory alloc] 137 bvc_factory_.reset([[TestBVCDependencyFactory alloc]
136 initWithBrowserState:chrome_browser_state_.get()]); 138 initWithBrowserState:chrome_browser_state_.get()]);
137 bvc_.reset([[BrowserViewController alloc] 139 bvc_.reset([[BrowserViewController alloc]
138 initWithTabModel:tab_model_ 140 initWithTabModel:tab_model_
139 browserState:chrome_browser_state_.get() 141 browserState:chrome_browser_state_.get()
(...skipping 26 matching lines...) Expand all
166 // NSAutoreleasePool can drain. This needs to be done before 168 // NSAutoreleasePool can drain. This needs to be done before
167 // |chrome_browser_state_| can be cleared. For tests that allocate more 169 // |chrome_browser_state_| can be cleared. For tests that allocate more
168 // objects, more runloop time may be required. 170 // objects, more runloop time may be required.
169 if (slow_teardown_) 171 if (slow_teardown_)
170 SpinRunLoop(.5); 172 SpinRunLoop(.5);
171 PerfTest::TearDown(); 173 PerfTest::TearDown();
172 174
173 // The profiles can be deallocated only after the BVC has been deallocated. 175 // The profiles can be deallocated only after the BVC has been deallocated.
174 chrome_browser_state_.reset(); 176 chrome_browser_state_.reset();
175 } 177 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/tabs/tab_model_unittest.mm ('k') | ios/chrome/browser/ui/main/browser_view_wrangler.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698