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

Unified Diff: ios/web/web_state/web_state_impl_unittest.mm

Issue 2755823002: Moved |openedByDOM| to WebState's CreateParams and public interface. (Closed)
Patch Set: . 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
« no previous file with comments | « ios/web/web_state/web_state_impl.mm ('k') | ios/web/webui/crw_web_ui_manager_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/web_state_impl_unittest.mm
diff --git a/ios/web/web_state/web_state_impl_unittest.mm b/ios/web/web_state/web_state_impl_unittest.mm
index c76254436d30f435f834d632924bf94f03257d88..1d4e61bc032b679c1788c3ca71c39fee789eae0c 100644
--- a/ios/web/web_state/web_state_impl_unittest.mm
+++ b/ios/web/web_state/web_state_impl_unittest.mm
@@ -162,7 +162,10 @@ bool HandleScriptCommand(bool* is_called,
// Test fixture for web::WebStateImpl class.
class WebStateImplTest : public web::WebTest {
protected:
- WebStateImplTest() : web_state_(new WebStateImpl(GetBrowserState())) {}
+ WebStateImplTest() : web::WebTest() {
+ web::WebState::CreateParams params(GetBrowserState());
+ web_state_ = base::MakeUnique<web::WebStateImpl>(params);
+ }
std::unique_ptr<WebStateImpl> web_state_;
};
@@ -681,4 +684,19 @@ bool HandleScriptCommand(bool* is_called,
web_state_->RemoveScriptCommandCallback(kPrefix2);
}
+// Tests that WebState::CreateParams::created_with_opener is translated to
+// WebState::HasOpener() return values.
+TEST_F(WebStateImplTest, CreatedWithOpener) {
+ // Verify that the HasOpener() returns false if not specified in the create
+ // params.
+ EXPECT_FALSE(web_state_->HasOpener());
+ // Set |created_with_opener| to true and verify that HasOpener() returns true.
+ WebState::CreateParams params_with_opener =
+ WebState::CreateParams(GetBrowserState());
+ params_with_opener.created_with_opener = true;
+ std::unique_ptr<WebState> web_state_with_opener =
+ WebState::Create(params_with_opener);
+ EXPECT_TRUE(web_state_with_opener->HasOpener());
+}
+
} // namespace web
« no previous file with comments | « ios/web/web_state/web_state_impl.mm ('k') | ios/web/webui/crw_web_ui_manager_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698