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

Side by Side Diff: ios/web_view/test/chrome_web_view_restorable_state_inttest.mm

Issue 2940953003: Consolidated all CWVWebView test helpers inside web_view_test_util file. (Closed)
Patch Set: Addressed review comments Created 3 years, 6 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 <ChromeWebView/ChromeWebView.h> 5 #import <ChromeWebView/ChromeWebView.h>
6 6
7 #import "ios/web_view/test/chrome_web_view_test.h" 7 #import "ios/web_view/test/chrome_web_view_test.h"
8 #import "ios/web_view/test/web_view_test_util.h" 8 #import "ios/web_view/test/web_view_test_util.h"
9 #include "testing/gtest_mac.h" 9 #include "testing/gtest_mac.h"
10 10
(...skipping 23 matching lines...) Expand all
34 34
35 // Tests encodeRestorableStateWithCoder: and decodeRestorableStateWithCoder: 35 // Tests encodeRestorableStateWithCoder: and decodeRestorableStateWithCoder:
36 // methods. 36 // methods.
37 typedef ios_web_view::ChromeWebViewTest ChromeWebViewRestorableStateTest; 37 typedef ios_web_view::ChromeWebViewTest ChromeWebViewRestorableStateTest;
38 TEST_F(ChromeWebViewRestorableStateTest, EncodeDecode) { 38 TEST_F(ChromeWebViewRestorableStateTest, EncodeDecode) {
39 // Load 2 URLs to create non-default state. 39 // Load 2 URLs to create non-default state.
40 ASSERT_FALSE([web_view_ lastCommittedURL]); 40 ASSERT_FALSE([web_view_ lastCommittedURL]);
41 ASSERT_FALSE([web_view_ visibleURL]); 41 ASSERT_FALSE([web_view_ visibleURL]);
42 ASSERT_FALSE([web_view_ canGoBack]); 42 ASSERT_FALSE([web_view_ canGoBack]);
43 ASSERT_FALSE([web_view_ canGoForward]); 43 ASSERT_FALSE([web_view_ canGoForward]);
44 LoadUrl(web_view_, [NSURL URLWithString:@"about:newtab"]); 44 ASSERT_TRUE(test::LoadUrl(web_view_, [NSURL URLWithString:@"about:newtab"]));
45 ASSERT_NSEQ(@"about:newtab", [web_view_ lastCommittedURL].absoluteString); 45 ASSERT_NSEQ(@"about:newtab", [web_view_ lastCommittedURL].absoluteString);
46 ASSERT_NSEQ(@"about:newtab", [web_view_ visibleURL].absoluteString); 46 ASSERT_NSEQ(@"about:newtab", [web_view_ visibleURL].absoluteString);
47 LoadUrl(web_view_, [NSURL URLWithString:@"about:blank"]); 47 ASSERT_TRUE(test::LoadUrl(web_view_, [NSURL URLWithString:@"about:blank"]));
48 ASSERT_NSEQ(@"about:blank", [web_view_ lastCommittedURL].absoluteString); 48 ASSERT_NSEQ(@"about:blank", [web_view_ lastCommittedURL].absoluteString);
49 ASSERT_NSEQ(@"about:blank", [web_view_ visibleURL].absoluteString); 49 ASSERT_NSEQ(@"about:blank", [web_view_ visibleURL].absoluteString);
50 ASSERT_TRUE([web_view_ canGoBack]); 50 ASSERT_TRUE([web_view_ canGoBack]);
51 ASSERT_FALSE([web_view_ canGoForward]); 51 ASSERT_FALSE([web_view_ canGoForward]);
52 52
53 // Create second web view and restore its state from the first web view. 53 // Create second web view and restore its state from the first web view.
54 CWVWebView* restored_web_view = CreateWebViewWithState(web_view_); 54 CWVWebView* restored_web_view = CreateWebViewWithState(web_view_);
55 55
56 // Verify that the state has been restored correctly. 56 // Verify that the state has been restored correctly.
57 EXPECT_NSEQ(@"about:blank", 57 EXPECT_NSEQ(@"about:blank",
58 [restored_web_view lastCommittedURL].absoluteString); 58 [restored_web_view lastCommittedURL].absoluteString);
59 EXPECT_NSEQ(@"about:blank", [restored_web_view visibleURL].absoluteString); 59 EXPECT_NSEQ(@"about:blank", [restored_web_view visibleURL].absoluteString);
60 EXPECT_TRUE([web_view_ canGoBack]); 60 EXPECT_TRUE([web_view_ canGoBack]);
61 EXPECT_FALSE([web_view_ canGoForward]); 61 EXPECT_FALSE([web_view_ canGoForward]);
62 } 62 }
63 63
64 } // namespace ios_web_view 64 } // namespace ios_web_view
OLDNEW
« no previous file with comments | « ios/web_view/test/chrome_web_view_kvo_inttest.mm ('k') | ios/web_view/test/chrome_web_view_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698