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

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

Issue 2896623003: Added web::NavigationContext::GetPageTransition. (Closed)
Patch Set: Fixed condition for SetIsCreatedFromHashChange call Created 3 years, 7 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 SetIgnoreRenderProcessCrashesDuringTesting(true); 344 SetIgnoreRenderProcessCrashesDuringTesting(true);
345 ASSERT_FALSE(observer->render_process_gone_info()); 345 ASSERT_FALSE(observer->render_process_gone_info());
346 web_state_->OnRenderProcessGone(); 346 web_state_->OnRenderProcessGone();
347 ASSERT_TRUE(observer->render_process_gone_info()); 347 ASSERT_TRUE(observer->render_process_gone_info());
348 EXPECT_EQ(web_state_.get(), observer->render_process_gone_info()->web_state); 348 EXPECT_EQ(web_state_.get(), observer->render_process_gone_info()->web_state);
349 349
350 // Test that DidFinishNavigation() is called. 350 // Test that DidFinishNavigation() is called.
351 ASSERT_FALSE(observer->did_finish_navigation_info()); 351 ASSERT_FALSE(observer->did_finish_navigation_info());
352 const GURL url("http://test"); 352 const GURL url("http://test");
353 std::unique_ptr<web::NavigationContext> context = 353 std::unique_ptr<web::NavigationContext> context =
354 NavigationContextImpl::CreateNavigationContext(web_state_.get(), url); 354 NavigationContextImpl::CreateNavigationContext(
355 web_state_.get(), url,
356 ui::PageTransition::PAGE_TRANSITION_AUTO_BOOKMARK);
355 web_state_->OnNavigationFinished(context.get()); 357 web_state_->OnNavigationFinished(context.get());
356 ASSERT_TRUE(observer->did_finish_navigation_info()); 358 ASSERT_TRUE(observer->did_finish_navigation_info());
357 EXPECT_EQ(web_state_.get(), 359 EXPECT_EQ(web_state_.get(),
358 observer->did_finish_navigation_info()->web_state); 360 observer->did_finish_navigation_info()->web_state);
359 NavigationContext* actual_context = 361 NavigationContext* actual_context =
360 observer->did_finish_navigation_info()->context.get(); 362 observer->did_finish_navigation_info()->context.get();
361 EXPECT_EQ(context->GetUrl(), actual_context->GetUrl()); 363 EXPECT_EQ(context->GetUrl(), actual_context->GetUrl());
364 EXPECT_TRUE(PageTransitionTypeIncludingQualifiersIs(
365 context->GetPageTransition(), actual_context->GetPageTransition()));
362 EXPECT_FALSE(actual_context->IsSameDocument()); 366 EXPECT_FALSE(actual_context->IsSameDocument());
363 EXPECT_FALSE(actual_context->IsErrorPage()); 367 EXPECT_FALSE(actual_context->IsErrorPage());
364 EXPECT_FALSE(actual_context->GetResponseHeaders()); 368 EXPECT_FALSE(actual_context->GetResponseHeaders());
365 369
366 // Test that DidStartNavigation() is called. 370 // Test that DidStartNavigation() is called.
367 ASSERT_FALSE(observer->did_start_navigation_info()); 371 ASSERT_FALSE(observer->did_start_navigation_info());
368 web_state_->OnNavigationStarted(context.get()); 372 web_state_->OnNavigationStarted(context.get());
369 ASSERT_TRUE(observer->did_start_navigation_info()); 373 ASSERT_TRUE(observer->did_start_navigation_info());
370 EXPECT_EQ(web_state_.get(), observer->did_start_navigation_info()->web_state); 374 EXPECT_EQ(web_state_.get(), observer->did_start_navigation_info()->web_state);
371 actual_context = observer->did_start_navigation_info()->context.get(); 375 actual_context = observer->did_start_navigation_info()->context.get();
372 EXPECT_EQ(context->GetUrl(), actual_context->GetUrl()); 376 EXPECT_EQ(context->GetUrl(), actual_context->GetUrl());
377 EXPECT_TRUE(PageTransitionTypeIncludingQualifiersIs(
378 context->GetPageTransition(), actual_context->GetPageTransition()));
373 EXPECT_FALSE(actual_context->IsSameDocument()); 379 EXPECT_FALSE(actual_context->IsSameDocument());
374 EXPECT_FALSE(actual_context->IsErrorPage()); 380 EXPECT_FALSE(actual_context->IsErrorPage());
375 EXPECT_FALSE(actual_context->GetResponseHeaders()); 381 EXPECT_FALSE(actual_context->GetResponseHeaders());
376 382
377 // Test that NavigationItemsPruned() is called. 383 // Test that NavigationItemsPruned() is called.
378 ASSERT_FALSE(observer->navigation_items_pruned_info()); 384 ASSERT_FALSE(observer->navigation_items_pruned_info());
379 web_state_->OnNavigationItemsPruned(1); 385 web_state_->OnNavigationItemsPruned(1);
380 ASSERT_TRUE(observer->navigation_items_pruned_info()); 386 ASSERT_TRUE(observer->navigation_items_pruned_info());
381 EXPECT_EQ(web_state_.get(), 387 EXPECT_EQ(web_state_.get(),
382 observer->navigation_items_pruned_info()->web_state); 388 observer->navigation_items_pruned_info()->web_state);
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 // Set |created_with_opener| to true and verify that HasOpener() returns true. 692 // Set |created_with_opener| to true and verify that HasOpener() returns true.
687 WebState::CreateParams params_with_opener = 693 WebState::CreateParams params_with_opener =
688 WebState::CreateParams(GetBrowserState()); 694 WebState::CreateParams(GetBrowserState());
689 params_with_opener.created_with_opener = true; 695 params_with_opener.created_with_opener = true;
690 std::unique_ptr<WebState> web_state_with_opener = 696 std::unique_ptr<WebState> web_state_with_opener =
691 WebState::Create(params_with_opener); 697 WebState::Create(params_with_opener);
692 EXPECT_TRUE(web_state_with_opener->HasOpener()); 698 EXPECT_TRUE(web_state_with_opener->HasOpener());
693 } 699 }
694 700
695 } // namespace web 701 } // namespace web
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698