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

Unified Diff: ios/chrome/browser/sessions/session_window_unittest.mm

Issue 2755823002: Moved |openedByDOM| to WebState's CreateParams and public interface. (Closed)
Patch Set: test fix & removed include Created 3 years, 9 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
Index: ios/chrome/browser/sessions/session_window_unittest.mm
diff --git a/ios/chrome/browser/sessions/session_window_unittest.mm b/ios/chrome/browser/sessions/session_window_unittest.mm
index 15508700496f76af83d555ed462ada726288e168..4c69ff39e749117f61894e2cb150401b84d0eb53 100644
--- a/ios/chrome/browser/sessions/session_window_unittest.mm
+++ b/ios/chrome/browser/sessions/session_window_unittest.mm
@@ -22,8 +22,6 @@
#include "testing/platform_test.h"
#import "third_party/ocmock/OCMock/OCMock.h"
-using web::WebStateImpl;
-
@interface SessionWindowIOS (Testing)
- (void)clearSessions;
@@ -40,10 +38,11 @@ void SetUp() override {
chrome_browser_state_ = test_cbs_builder.Build();
}
- WebStateImpl* CreateWebState(BOOL openedByDOM) const {
- WebStateImpl* webState = new WebStateImpl(chrome_browser_state_.get());
- webState->GetNavigationManagerImpl().InitializeSession(openedByDOM);
- return webState;
+ std::unique_ptr<web::WebState> CreateWebState(
+ bool created_with_opener) const {
+ web::WebState::CreateParams params(chrome_browser_state_.get());
+ params.created_with_opener = created_with_opener;
+ return web::WebState::Create(params);
}
web::TestWebThreadBundle thread_bundle_;
@@ -59,8 +58,10 @@ void SetUp() override {
}
TEST_F(SessionWindowIOSTest, InitAddingSessions) {
- std::unique_ptr<WebStateImpl> webState1(CreateWebState(NO));
- std::unique_ptr<WebStateImpl> webState2(CreateWebState(NO));
+ std::unique_ptr<web::WebState> webState1 =
Eugene But (OOO till 7-30) 2017/03/18 00:33:29 nit: s/webState1/web_state_1 since you touching th
kkhorimoto 2017/03/20 22:39:20 Done.
+ CreateWebState(false /*created_with_opener*/);
+ std::unique_ptr<web::WebState> webState2 =
+ CreateWebState(false /*created_with_opener*/);
base::scoped_nsobject<SessionWindowIOS> sessionWindow(
[[SessionWindowIOS alloc] init]);
[sessionWindow addSerializedSessionStorage:webState1->BuildSessionStorage()];
@@ -77,8 +78,10 @@ void SetUp() override {
base::scoped_nsobject<SessionWindowIOS> sessionWindow(
[[SessionWindowIOS alloc] init]);
- std::unique_ptr<WebStateImpl> webState1(CreateWebState(YES));
- std::unique_ptr<WebStateImpl> webState2(CreateWebState(NO));
+ std::unique_ptr<web::WebState> webState1 =
+ CreateWebState(true /*created_with_opener*/);
+ std::unique_ptr<web::WebState> webState2 =
+ CreateWebState(false /*created_with_opener*/);
[sessionWindow addSerializedSessionStorage:webState1->BuildSessionStorage()];
[sessionWindow addSerializedSessionStorage:webState2->BuildSessionStorage()];
@@ -96,10 +99,10 @@ void SetUp() override {
NSArray* sessions = unarchivedObj.sessions;
ASSERT_EQ(2U, sessions.count);
CRWSessionStorage* unarchivedSession1 = sessions[0];
- EXPECT_TRUE(unarchivedSession1.openedByDOM);
+ EXPECT_TRUE(unarchivedSession1.hasOpener);
CRWSessionStorage* unarchivedSession2 = sessions[1];
- EXPECT_FALSE(unarchivedSession2.openedByDOM);
+ EXPECT_FALSE(unarchivedSession2.hasOpener);
}
} // anonymous namespace

Powered by Google App Engine
This is Rietveld 408576698