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

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

Issue 2724953004: Test actual arguments in WebStateImplTest::ObserverTest. (Closed)
Patch Set: Rebased 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/public/web_state/web_state_observer_bridge.h" 5 #import "ios/web/public/web_state/web_state_observer_bridge.h"
6 6
7 #import "base/mac/scoped_nsobject.h" 7 #import "base/mac/scoped_nsobject.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "ios/web/public/favicon_url.h" 9 #include "ios/web/public/favicon_url.h"
10 #import "ios/web/public/test/fakes/crw_test_web_state_observer.h" 10 #import "ios/web/public/test/fakes/crw_test_web_state_observer.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 ASSERT_FALSE([observer_ didFinishNavigationInfo]); 46 ASSERT_FALSE([observer_ didFinishNavigationInfo]);
47 47
48 GURL url("https://chromium.test/"); 48 GURL url("https://chromium.test/");
49 std::unique_ptr<web::NavigationContext> context = 49 std::unique_ptr<web::NavigationContext> context =
50 web::NavigationContextImpl::CreateNavigationContext(&test_web_state_, 50 web::NavigationContextImpl::CreateNavigationContext(&test_web_state_,
51 url); 51 url);
52 bridge_->DidFinishNavigation(context.get()); 52 bridge_->DidFinishNavigation(context.get());
53 53
54 ASSERT_TRUE([observer_ didFinishNavigationInfo]); 54 ASSERT_TRUE([observer_ didFinishNavigationInfo]);
55 EXPECT_EQ(&test_web_state_, [observer_ didFinishNavigationInfo]->web_state); 55 EXPECT_EQ(&test_web_state_, [observer_ didFinishNavigationInfo]->web_state);
56 EXPECT_EQ(context.get(), [observer_ didFinishNavigationInfo]->context); 56 web::NavigationContext* actual_context =
57 [observer_ didFinishNavigationInfo]->context.get();
58 ASSERT_TRUE(actual_context);
59 EXPECT_EQ(&test_web_state_, actual_context->GetWebState());
60 EXPECT_EQ(context->IsSamePage(), actual_context->IsSamePage());
61 EXPECT_EQ(context->IsErrorPage(), actual_context->IsErrorPage());
62 EXPECT_EQ(context->GetUrl(), actual_context->GetUrl());
57 } 63 }
58 64
59 // Tests |webState:didCommitNavigationWithDetails:| forwarding. 65 // Tests |webState:didCommitNavigationWithDetails:| forwarding.
60 TEST_F(WebStateObserverBridgeTest, NavigationItemCommitted) { 66 TEST_F(WebStateObserverBridgeTest, NavigationItemCommitted) {
61 ASSERT_FALSE([observer_ commitNavigationInfo]); 67 ASSERT_FALSE([observer_ commitNavigationInfo]);
62 68
63 LoadCommittedDetails load_details; 69 LoadCommittedDetails load_details;
64 load_details.item = reinterpret_cast<web::NavigationItem*>(1); 70 load_details.item = reinterpret_cast<web::NavigationItem*>(1);
65 load_details.previous_item_index = 15; 71 load_details.previous_item_index = 15;
66 load_details.previous_url = GURL("https://chromium.test/"); 72 load_details.previous_url = GURL("https://chromium.test/");
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // Tests |webState:webStateDidStartLoading:| forwarding. 215 // Tests |webState:webStateDidStartLoading:| forwarding.
210 TEST_F(WebStateObserverBridgeTest, DidStartLoading) { 216 TEST_F(WebStateObserverBridgeTest, DidStartLoading) {
211 ASSERT_FALSE([observer_ startLoadingInfo]); 217 ASSERT_FALSE([observer_ startLoadingInfo]);
212 218
213 bridge_->DidStartLoading(); 219 bridge_->DidStartLoading();
214 ASSERT_TRUE([observer_ startLoadingInfo]); 220 ASSERT_TRUE([observer_ startLoadingInfo]);
215 EXPECT_EQ(&test_web_state_, [observer_ startLoadingInfo]->web_state); 221 EXPECT_EQ(&test_web_state_, [observer_ startLoadingInfo]->web_state);
216 } 222 }
217 223
218 } // namespace web 224 } // namespace web
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698