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

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

Issue 2718733003: Removed -[CRWWebDelegate webDidUpdateHistoryStateWithPageURL]. (Closed)
Patch Set: Created 3 years, 10 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_observer_bridge.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 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"
11 #import "ios/web/public/test/fakes/test_web_state.h" 11 #import "ios/web/public/test/fakes/test_web_state.h"
12 #import "ios/web/public/web_state/web_state_observer_bridge.h" 12 #import "ios/web/public/web_state/web_state_observer_bridge.h"
13 #include "ios/web/web_state/navigation_context_impl.h"
13 #include "testing/platform_test.h" 14 #include "testing/platform_test.h"
14 15
15 namespace web { 16 namespace web {
16 17
17 // Test fixture to test WebStateObserverBridge class. 18 // Test fixture to test WebStateObserverBridge class.
18 class WebStateObserverBridgeTest : public PlatformTest { 19 class WebStateObserverBridgeTest : public PlatformTest {
19 protected: 20 protected:
20 WebStateObserverBridgeTest() 21 WebStateObserverBridgeTest()
21 : observer_([[CRWTestWebStateObserver alloc] init]), 22 : observer_([[CRWTestWebStateObserver alloc] init]),
22 bridge_(base::MakeUnique<WebStateObserverBridge>(&test_web_state_, 23 bridge_(base::MakeUnique<WebStateObserverBridge>(&test_web_state_,
(...skipping 10 matching lines...) Expand all
33 34
34 GURL url("https://chromium.test/"); 35 GURL url("https://chromium.test/");
35 bridge_->ProvisionalNavigationStarted(url); 36 bridge_->ProvisionalNavigationStarted(url);
36 37
37 ASSERT_TRUE([observer_ startProvisionalNavigationInfo]); 38 ASSERT_TRUE([observer_ startProvisionalNavigationInfo]);
38 EXPECT_EQ(&test_web_state_, 39 EXPECT_EQ(&test_web_state_,
39 [observer_ startProvisionalNavigationInfo]->web_state); 40 [observer_ startProvisionalNavigationInfo]->web_state);
40 EXPECT_EQ(url, [observer_ startProvisionalNavigationInfo]->url); 41 EXPECT_EQ(url, [observer_ startProvisionalNavigationInfo]->url);
41 } 42 }
42 43
44 // Tests |webState:didFinishNavigation:| forwarding.
45 TEST_F(WebStateObserverBridgeTest, DidFinishNavigation) {
46 ASSERT_FALSE([observer_ didFinishNavigationInfo]);
47
48 GURL url("https://chromium.test/");
49 std::unique_ptr<web::NavigationContext> context =
50 web::NavigationContextImpl::CreateNavigationContext(&test_web_state_,
51 url);
52 bridge_->DidFinishNavigation(context.get());
53
54 ASSERT_TRUE([observer_ didFinishNavigationInfo]);
55 EXPECT_EQ(&test_web_state_, [observer_ didFinishNavigationInfo]->web_state);
56 EXPECT_EQ(context.get(), [observer_ didFinishNavigationInfo]->context);
57 }
58
43 // Tests |webState:didCommitNavigationWithDetails:| forwarding. 59 // Tests |webState:didCommitNavigationWithDetails:| forwarding.
44 TEST_F(WebStateObserverBridgeTest, NavigationItemCommitted) { 60 TEST_F(WebStateObserverBridgeTest, NavigationItemCommitted) {
45 ASSERT_FALSE([observer_ commitNavigationInfo]); 61 ASSERT_FALSE([observer_ commitNavigationInfo]);
46 62
47 LoadCommittedDetails load_details; 63 LoadCommittedDetails load_details;
48 load_details.item = reinterpret_cast<web::NavigationItem*>(1); 64 load_details.item = reinterpret_cast<web::NavigationItem*>(1);
49 load_details.previous_item_index = 15; 65 load_details.previous_item_index = 15;
50 load_details.previous_url = GURL("https://chromium.test/"); 66 load_details.previous_url = GURL("https://chromium.test/");
51 load_details.is_in_page = true; 67 load_details.is_in_page = true;
52 68
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 // Tests |webState:webStateDidStartLoading:| forwarding. 218 // Tests |webState:webStateDidStartLoading:| forwarding.
203 TEST_F(WebStateObserverBridgeTest, DidStartLoading) { 219 TEST_F(WebStateObserverBridgeTest, DidStartLoading) {
204 ASSERT_FALSE([observer_ startLoadingInfo]); 220 ASSERT_FALSE([observer_ startLoadingInfo]);
205 221
206 bridge_->DidStartLoading(); 222 bridge_->DidStartLoading();
207 ASSERT_TRUE([observer_ startLoadingInfo]); 223 ASSERT_TRUE([observer_ startLoadingInfo]);
208 EXPECT_EQ(&test_web_state_, [observer_ startLoadingInfo]->web_state); 224 EXPECT_EQ(&test_web_state_, [observer_ startLoadingInfo]->web_state);
209 } 225 }
210 226
211 } // namespace web 227 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/web_state/web_state_observer_bridge.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698