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

Unified Diff: ios/chrome/test/app/chrome_test_util.mm

Issue 2615003002: Use ChromeBrowserStateManager instead of BrowserListIOS. (Closed)
Patch Set: Fix ios_chrome_perftests. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/test/app/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/test/app/chrome_test_util.mm
diff --git a/ios/chrome/test/app/chrome_test_util.mm b/ios/chrome/test/app/chrome_test_util.mm
index 0f9fbcaf8d20c7259e0b3477ed4eed2d880f5ec7..9f43f5a729f2b27a9ccd6e1ef9523680d20880f8 100644
--- a/ios/chrome/test/app/chrome_test_util.mm
+++ b/ios/chrome/test/app/chrome_test_util.mm
@@ -16,10 +16,10 @@
#import "ios/chrome/app/main_controller_private.h"
#include "ios/chrome/browser/application_context.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
+#include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h"
#import "ios/chrome/browser/metrics/previous_session_info.h"
#import "ios/chrome/browser/metrics/previous_session_info_private.h"
#import "ios/chrome/browser/tabs/tab.h"
-#import "ios/chrome/browser/ui/browser_list_ios.h"
#import "ios/chrome/browser/ui/browser_view_controller.h"
#import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
#import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
@@ -65,14 +65,17 @@ Tab* GetCurrentTab() {
// Returns the original ChromeBrowserState if |incognito| is false. If
// |ingonito| is true, returns an off-the-record ChromeBrowserState.
ios::ChromeBrowserState* GetBrowserState(bool incognito) {
- DCHECK(!BrowserListIOS::empty());
- id<BrowserIOS> browser = *BrowserListIOS::begin();
- DCHECK(browser);
- ios::ChromeBrowserState* browser_state = [browser browserState];
- DCHECK(browser_state);
- browser_state = incognito ? browser_state->GetOffTheRecordChromeBrowserState()
- : browser_state->GetOriginalChromeBrowserState();
- return browser_state;
+ std::vector<ios::ChromeBrowserState*> browser_states =
+ GetApplicationContext()
+ ->GetChromeBrowserStateManager()
+ ->GetLoadedBrowserStates();
+ DCHECK(!browser_states.empty());
+
+ ios::ChromeBrowserState* browser_state = browser_states.front();
+ DCHECK(!browser_state->IsOffTheRecord());
+
+ return incognito ? browser_state->GetOffTheRecordChromeBrowserState()
+ : browser_state;
}
// Gets the root UIViewController.
« no previous file with comments | « ios/chrome/test/app/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698