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

Side by Side Diff: ios/web/web_state/navigation_callbacks_inttest.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 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 #include <memory> 5 #include <memory>
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #import "ios/web/public/navigation_item.h" 8 #import "ios/web/public/navigation_item.h"
9 #import "ios/web/public/navigation_manager.h" 9 #import "ios/web/public/navigation_manager.h"
10 #import "ios/web/public/test/http_server.h" 10 #import "ios/web/public/test/http_server.h"
(...skipping 11 matching lines...) Expand all
22 22
23 namespace { 23 namespace {
24 24
25 // Verifies correctness of |NavigationContext| for new page navigation passed to 25 // Verifies correctness of |NavigationContext| for new page navigation passed to
26 // |DidFinishNavigation|. 26 // |DidFinishNavigation|.
27 ACTION_P2(VerifyNewPageContext, web_state, url) { 27 ACTION_P2(VerifyNewPageContext, web_state, url) {
28 NavigationContext* context = arg0; 28 NavigationContext* context = arg0;
29 ASSERT_TRUE(context); 29 ASSERT_TRUE(context);
30 EXPECT_EQ(web_state, context->GetWebState()); 30 EXPECT_EQ(web_state, context->GetWebState());
31 EXPECT_EQ(url, context->GetUrl()); 31 EXPECT_EQ(url, context->GetUrl());
32 EXPECT_FALSE(context->IsSamePage()); 32 EXPECT_FALSE(context->IsSameDocument());
33 EXPECT_FALSE(context->IsErrorPage()); 33 EXPECT_FALSE(context->IsErrorPage());
34 NavigationManager* navigation_manager = web_state->GetNavigationManager(); 34 NavigationManager* navigation_manager = web_state->GetNavigationManager();
35 NavigationItem* item = navigation_manager->GetLastCommittedItem(); 35 NavigationItem* item = navigation_manager->GetLastCommittedItem();
36 EXPECT_GT(item->GetTimestamp().ToInternalValue(), 0); 36 EXPECT_GT(item->GetTimestamp().ToInternalValue(), 0);
37 EXPECT_EQ(url, item->GetURL()); 37 EXPECT_EQ(url, item->GetURL());
38 } 38 }
39 39
40 // Verifies correctness of |NavigationContext| for same page navigation passed 40 // Verifies correctness of |NavigationContext| for same page navigation passed
41 // to |DidFinishNavigation|. 41 // to |DidFinishNavigation|.
42 ACTION_P2(VerifySamePageContext, web_state, url) { 42 ACTION_P2(VerifySamePageContext, web_state, url) {
43 NavigationContext* context = arg0; 43 NavigationContext* context = arg0;
44 ASSERT_TRUE(context); 44 ASSERT_TRUE(context);
45 EXPECT_EQ(web_state, context->GetWebState()); 45 EXPECT_EQ(web_state, context->GetWebState());
46 EXPECT_EQ(url, context->GetUrl()); 46 EXPECT_EQ(url, context->GetUrl());
47 EXPECT_TRUE(context->IsSamePage()); 47 EXPECT_TRUE(context->IsSameDocument());
48 EXPECT_FALSE(context->IsErrorPage()); 48 EXPECT_FALSE(context->IsErrorPage());
49 NavigationManager* navigation_manager = web_state->GetNavigationManager(); 49 NavigationManager* navigation_manager = web_state->GetNavigationManager();
50 NavigationItem* item = navigation_manager->GetLastCommittedItem(); 50 NavigationItem* item = navigation_manager->GetLastCommittedItem();
51 EXPECT_GT(item->GetTimestamp().ToInternalValue(), 0); 51 EXPECT_GT(item->GetTimestamp().ToInternalValue(), 0);
52 EXPECT_EQ(url, item->GetURL()); 52 EXPECT_EQ(url, item->GetURL());
53 } 53 }
54 54
55 // Mocks DidFinishNavigation navigation callback. 55 // Mocks DidFinishNavigation navigation callback.
56 class WebStateObserverMock : public WebStateObserver { 56 class WebStateObserverMock : public WebStateObserver {
57 public: 57 public:
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 // Tests native content navigation. 161 // Tests native content navigation.
162 TEST_F(DidFinishNavigationTest, NativeContentNavigation) { 162 TEST_F(DidFinishNavigationTest, NativeContentNavigation) {
163 GURL url(url::SchemeHostPort(kTestNativeContentScheme, "ui", 0).Serialize()); 163 GURL url(url::SchemeHostPort(kTestNativeContentScheme, "ui", 0).Serialize());
164 EXPECT_CALL(*observer_, DidFinishNavigation(_)) 164 EXPECT_CALL(*observer_, DidFinishNavigation(_))
165 .WillOnce(VerifyNewPageContext(web_state(), url)); 165 .WillOnce(VerifyNewPageContext(web_state(), url));
166 LoadUrl(url); 166 LoadUrl(url);
167 } 167 }
168 168
169 } // namespace web 169 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/public/web_state/web_state_observer.h ('k') | ios/web/web_state/navigation_context_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698