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

Side by Side Diff: ios/chrome/browser/tabs/tab_model_unittest.mm

Issue 2621083003: Implement 1:N mapping from ios::ChromeBrowserState to TabModel. (Closed)
Patch Set: 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 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 #import <objc/runtime.h> 5 #import <objc/runtime.h>
6 6
7 #include "base/mac/scoped_nsautorelease_pool.h" 7 #include "base/mac/scoped_nsautorelease_pool.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 TabModelTest() : web_client_(base::MakeUnique<ChromeWebClient>()) {} 140 TabModelTest() : web_client_(base::MakeUnique<ChromeWebClient>()) {}
141 141
142 protected: 142 protected:
143 void SetUp() override { 143 void SetUp() override {
144 DCHECK_CURRENTLY_ON(web::WebThread::UI); 144 DCHECK_CURRENTLY_ON(web::WebThread::UI);
145 PlatformTest::SetUp(); 145 PlatformTest::SetUp();
146 146
147 TestChromeBrowserState::Builder test_cbs_builder; 147 TestChromeBrowserState::Builder test_cbs_builder;
148 chrome_browser_state_ = test_cbs_builder.Build(); 148 chrome_browser_state_ = test_cbs_builder.Build();
149 149
150 sessionWindow_.reset([[SessionWindowIOS new] retain]); 150 sessionWindow_.reset([[SessionWindowIOS alloc] init]);
sdefresne 2017/01/10 17:49:28 nit: this is unrelated but I based my tab_model_li
marq (ping after 24h) 2017/01/11 15:56:47 Acknowledged.
151 // Create tab model with just a dummy session service so the async state 151 // Create tab model with just a dummy session service so the async state
152 // saving doesn't trigger unless actually wanted. 152 // saving doesn't trigger unless actually wanted.
153 base::scoped_nsobject<TestSessionService> test_service( 153 base::scoped_nsobject<TestSessionService> test_service(
154 [[TestSessionService alloc] init]); 154 [[TestSessionService alloc] init]);
155 tabModel_.reset([[TabModel alloc] 155 tabModel_.reset([[TabModel alloc]
156 initWithSessionWindow:sessionWindow_.get() 156 initWithSessionWindow:sessionWindow_.get()
157 sessionService:test_service 157 sessionService:test_service
158 browserState:chrome_browser_state_.get()]); 158 browserState:chrome_browser_state_.get()]);
159 [tabModel_ setWebUsageEnabled:YES]; 159 [tabModel_ setWebUsageEnabled:YES];
160 [tabModel_ setPrimary:YES]; 160 [tabModel_ setPrimary:YES];
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 browserState:chrome_browser_state_.get()]); 881 browserState:chrome_browser_state_.get()]);
882 EXPECT_EQ(model.get().currentTab, [model tabAtIndex:1]); 882 EXPECT_EQ(model.get().currentTab, [model tabAtIndex:1]);
883 [model browserStateDestroyed]; 883 [model browserStateDestroyed];
884 884
885 // Clean up. 885 // Clean up.
886 EXPECT_TRUE([[NSFileManager defaultManager] removeItemAtPath:stashPath 886 EXPECT_TRUE([[NSFileManager defaultManager] removeItemAtPath:stashPath
887 error:nullptr]); 887 error:nullptr]);
888 } 888 }
889 889
890 } // anonymous namespace 890 } // anonymous namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698