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

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

Issue 2734293002: s/IsSamePage/IsSameDocument for NavigationContext. (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
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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 // Test that DidFinishNavigation() is called for same page navigations. 379 // Test that DidFinishNavigation() is called for same page navigations.
380 ASSERT_FALSE(observer->did_finish_navigation_info()); 380 ASSERT_FALSE(observer->did_finish_navigation_info());
381 web_state_->OnSamePageNavigation(url); 381 web_state_->OnSamePageNavigation(url);
382 ASSERT_TRUE(observer->did_finish_navigation_info()); 382 ASSERT_TRUE(observer->did_finish_navigation_info());
383 EXPECT_EQ(web_state_.get(), 383 EXPECT_EQ(web_state_.get(),
384 observer->did_finish_navigation_info()->web_state); 384 observer->did_finish_navigation_info()->web_state);
385 NavigationContext* context = 385 NavigationContext* context =
386 observer->did_finish_navigation_info()->context.get(); 386 observer->did_finish_navigation_info()->context.get();
387 ASSERT_TRUE(context); 387 ASSERT_TRUE(context);
388 EXPECT_EQ(url, context->GetUrl()); 388 EXPECT_EQ(url, context->GetUrl());
389 EXPECT_TRUE(context->IsSamePage()); 389 EXPECT_TRUE(context->IsSameDocument());
390 EXPECT_FALSE(context->IsErrorPage()); 390 EXPECT_FALSE(context->IsErrorPage());
391 391
392 // Reset the observer and test that DidFinishNavigation() is called 392 // Reset the observer and test that DidFinishNavigation() is called
393 // for error navigations. 393 // for error navigations.
394 observer = base::MakeUnique<TestWebStateObserver>(web_state_.get()); 394 observer = base::MakeUnique<TestWebStateObserver>(web_state_.get());
395 ASSERT_FALSE(observer->did_finish_navigation_info()); 395 ASSERT_FALSE(observer->did_finish_navigation_info());
396 web_state_->OnErrorPageNavigation(url); 396 web_state_->OnErrorPageNavigation(url);
397 ASSERT_TRUE(observer->did_finish_navigation_info()); 397 ASSERT_TRUE(observer->did_finish_navigation_info());
398 EXPECT_EQ(web_state_.get(), 398 EXPECT_EQ(web_state_.get(),
399 observer->did_finish_navigation_info()->web_state); 399 observer->did_finish_navigation_info()->web_state);
400 context = observer->did_finish_navigation_info()->context.get(); 400 context = observer->did_finish_navigation_info()->context.get();
401 ASSERT_TRUE(context); 401 ASSERT_TRUE(context);
402 EXPECT_EQ(url, context->GetUrl()); 402 EXPECT_EQ(url, context->GetUrl());
403 EXPECT_FALSE(context->IsSamePage()); 403 EXPECT_FALSE(context->IsSameDocument());
404 EXPECT_TRUE(context->IsErrorPage()); 404 EXPECT_TRUE(context->IsErrorPage());
405 405
406 // Test that OnTitleChanged() is called. 406 // Test that OnTitleChanged() is called.
407 ASSERT_FALSE(observer->title_was_set_info()); 407 ASSERT_FALSE(observer->title_was_set_info());
408 web_state_->OnTitleChanged(); 408 web_state_->OnTitleChanged();
409 ASSERT_TRUE(observer->title_was_set_info()); 409 ASSERT_TRUE(observer->title_was_set_info());
410 EXPECT_EQ(web_state_.get(), observer->title_was_set_info()->web_state); 410 EXPECT_EQ(web_state_.get(), observer->title_was_set_info()->web_state);
411 411
412 // Test that WebStateDestroyed() is called. 412 // Test that WebStateDestroyed() is called.
413 EXPECT_FALSE(observer->web_state_destroyed_info()); 413 EXPECT_FALSE(observer->web_state_destroyed_info());
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 // Check that a false return value is forwarded correctly. 623 // Check that a false return value is forwarded correctly.
624 EXPECT_FALSE( 624 EXPECT_FALSE(
625 web_state_->OnScriptCommandReceived(kCommand2, value_2, kUrl2, false)); 625 web_state_->OnScriptCommandReceived(kCommand2, value_2, kUrl2, false));
626 EXPECT_FALSE(is_called_1); 626 EXPECT_FALSE(is_called_1);
627 EXPECT_TRUE(is_called_2); 627 EXPECT_TRUE(is_called_2);
628 628
629 web_state_->RemoveScriptCommandCallback(kPrefix2); 629 web_state_->RemoveScriptCommandCallback(kPrefix2);
630 } 630 }
631 631
632 } // namespace web 632 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/web_state/navigation_context_impl_unittest.mm ('k') | ios/web/web_state/web_state_observer_bridge_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698