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

Side by Side Diff: ios/web/web_state/web_state_impl_unittest.mm

Issue 2737353006: Replaced webPageOrderedClose with WebStateDelegate API. (Closed)
Patch Set: Addressed review comments 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') | no next file » | 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 EXPECT_FALSE(delegate.last_create_new_web_state_request()); 428 EXPECT_FALSE(delegate.last_create_new_web_state_request());
429 web_state_->CreateNewWebState(child_url, opener_url, true); 429 web_state_->CreateNewWebState(child_url, opener_url, true);
430 TestCreateNewWebStateRequest* create_new_web_state_request = 430 TestCreateNewWebStateRequest* create_new_web_state_request =
431 delegate.last_create_new_web_state_request(); 431 delegate.last_create_new_web_state_request();
432 ASSERT_TRUE(create_new_web_state_request); 432 ASSERT_TRUE(create_new_web_state_request);
433 EXPECT_EQ(web_state_.get(), create_new_web_state_request->web_state); 433 EXPECT_EQ(web_state_.get(), create_new_web_state_request->web_state);
434 EXPECT_EQ(child_url, create_new_web_state_request->url); 434 EXPECT_EQ(child_url, create_new_web_state_request->url);
435 EXPECT_EQ(opener_url, create_new_web_state_request->opener_url); 435 EXPECT_EQ(opener_url, create_new_web_state_request->opener_url);
436 EXPECT_TRUE(create_new_web_state_request->initiated_by_user); 436 EXPECT_TRUE(create_new_web_state_request->initiated_by_user);
437 437
438 // Test that CloseWebState() is called.
439 EXPECT_FALSE(delegate.last_close_web_state_request());
440 web_state_->CloseWebState();
441 ASSERT_TRUE(delegate.last_close_web_state_request());
442 EXPECT_EQ(web_state_.get(),
443 delegate.last_close_web_state_request()->web_state);
444
438 // Test that OpenURLFromWebState() is called. 445 // Test that OpenURLFromWebState() is called.
439 WebState::OpenURLParams params(GURL("https://chromium.test/"), Referrer(), 446 WebState::OpenURLParams params(GURL("https://chromium.test/"), Referrer(),
440 WindowOpenDisposition::CURRENT_TAB, 447 WindowOpenDisposition::CURRENT_TAB,
441 ui::PAGE_TRANSITION_LINK, true); 448 ui::PAGE_TRANSITION_LINK, true);
442 EXPECT_FALSE(delegate.last_open_url_request()); 449 EXPECT_FALSE(delegate.last_open_url_request());
443 web_state_->OpenURL(params); 450 web_state_->OpenURL(params);
444 TestOpenURLRequest* open_url_request = delegate.last_open_url_request(); 451 TestOpenURLRequest* open_url_request = delegate.last_open_url_request();
445 ASSERT_TRUE(open_url_request); 452 ASSERT_TRUE(open_url_request);
446 EXPECT_EQ(web_state_.get(), open_url_request->web_state); 453 EXPECT_EQ(web_state_.get(), open_url_request->web_state);
447 WebState::OpenURLParams actual_params = open_url_request->params; 454 WebState::OpenURLParams actual_params = open_url_request->params;
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 // Check that a false return value is forwarded correctly. 661 // Check that a false return value is forwarded correctly.
655 EXPECT_FALSE( 662 EXPECT_FALSE(
656 web_state_->OnScriptCommandReceived(kCommand2, value_2, kUrl2, false)); 663 web_state_->OnScriptCommandReceived(kCommand2, value_2, kUrl2, false));
657 EXPECT_FALSE(is_called_1); 664 EXPECT_FALSE(is_called_1);
658 EXPECT_TRUE(is_called_2); 665 EXPECT_TRUE(is_called_2);
659 666
660 web_state_->RemoveScriptCommandCallback(kPrefix2); 667 web_state_->RemoveScriptCommandCallback(kPrefix2);
661 } 668 }
662 669
663 } // namespace web 670 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/web_state/web_state_impl.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698