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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ios/web/web_state/web_state_impl.h" 5 #import "ios/web/web_state/web_state_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 EXPECT_TRUE(expected_value->Equals(&value)); 155 EXPECT_TRUE(expected_value->Equals(&value));
156 EXPECT_EQ(expected_url, url); 156 EXPECT_EQ(expected_url, url);
157 return should_handle; 157 return should_handle;
158 } 158 }
159 159
160 } // namespace 160 } // namespace
161 161
162 // Test fixture for web::WebStateImpl class. 162 // Test fixture for web::WebStateImpl class.
163 class WebStateImplTest : public web::WebTest { 163 class WebStateImplTest : public web::WebTest {
164 protected: 164 protected:
165 WebStateImplTest() : web_state_(new WebStateImpl(GetBrowserState())) {} 165 WebStateImplTest() : web::WebTest() {
166 web::WebState::CreateParams params(GetBrowserState());
167 web_state_ = base::MakeUnique<web::WebStateImpl>(params);
168 }
166 169
167 std::unique_ptr<WebStateImpl> web_state_; 170 std::unique_ptr<WebStateImpl> web_state_;
168 }; 171 };
169 172
170 TEST_F(WebStateImplTest, WebUsageEnabled) { 173 TEST_F(WebStateImplTest, WebUsageEnabled) {
171 // Default is false. 174 // Default is false.
172 ASSERT_FALSE(web_state_->IsWebUsageEnabled()); 175 ASSERT_FALSE(web_state_->IsWebUsageEnabled());
173 176
174 web_state_->SetWebUsageEnabled(true); 177 web_state_->SetWebUsageEnabled(true);
175 EXPECT_TRUE(web_state_->IsWebUsageEnabled()); 178 EXPECT_TRUE(web_state_->IsWebUsageEnabled());
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 677
675 // Check that a false return value is forwarded correctly. 678 // Check that a false return value is forwarded correctly.
676 EXPECT_FALSE( 679 EXPECT_FALSE(
677 web_state_->OnScriptCommandReceived(kCommand2, value_2, kUrl2, false)); 680 web_state_->OnScriptCommandReceived(kCommand2, value_2, kUrl2, false));
678 EXPECT_FALSE(is_called_1); 681 EXPECT_FALSE(is_called_1);
679 EXPECT_TRUE(is_called_2); 682 EXPECT_TRUE(is_called_2);
680 683
681 web_state_->RemoveScriptCommandCallback(kPrefix2); 684 web_state_->RemoveScriptCommandCallback(kPrefix2);
682 } 685 }
683 686
687 // Tests that WebState::CreateParams::created_with_opener is translated to
688 // WebState::HasOpener() return values.
689 TEST_F(WebStateImplTest, CreatedWithOpener) {
690 // Verify that the HasOpener() returns false if not specified in the create
691 // params.
692 EXPECT_FALSE(web_state_->HasOpener());
693 // Set |created_with_opener| to true and verify that HasOpener() returns true.
694 WebState::CreateParams params_with_opener =
695 WebState::CreateParams(GetBrowserState());
696 params_with_opener.created_with_opener = true;
697 std::unique_ptr<WebState> web_state_with_opener =
698 WebState::Create(params_with_opener);
699 EXPECT_TRUE(web_state_with_opener->HasOpener());
700 }
701
684 } // namespace web 702 } // namespace web
OLDNEW
« 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