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

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

Issue 2940953003: Consolidated all CWVWebView test helpers inside web_view_test_util file. (Closed)
Patch Set: 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
« no previous file with comments | « ios/web_view/test/chrome_web_view_test.h ('k') | ios/web_view/test/web_view_test_util.h » ('j') | 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_view/test/chrome_web_view_test.h" 5 #import "ios/web_view/test/chrome_web_view_test.h"
6 6
7 #import <ChromeWebView/ChromeWebView.h> 7 #import <ChromeWebView/ChromeWebView.h>
8 #import <Foundation/Foundation.h> 8 #import <Foundation/Foundation.h>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
11 #import "base/memory/ptr_util.h" 11 #import "base/memory/ptr_util.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #import "ios/testing/wait_util.h" 13 #import "ios/testing/wait_util.h"
michaeldo 2017/06/15 15:43:08 Remove wait_util.h import
Eugene But (OOO till 7-30) 2017/06/16 01:52:23 Good catch. Done.
14 #import "ios/web_view/test/web_view_test_util.h" 14 #import "ios/web_view/test/web_view_test_util.h"
15 #include "net/base/url_util.h" 15 #include "net/base/url_util.h"
16 #include "net/test/embedded_test_server/embedded_test_server.h" 16 #include "net/test/embedded_test_server/embedded_test_server.h"
17 #include "net/test/embedded_test_server/http_request.h" 17 #include "net/test/embedded_test_server/http_request.h"
18 #include "net/test/embedded_test_server/http_response.h" 18 #include "net/test/embedded_test_server/http_response.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 20
21 #if !defined(__has_feature) || !__has_feature(objc_arc) 21 #if !defined(__has_feature) || !__has_feature(objc_arc)
22 #error "This file requires ARC support." 22 #error "This file requires ARC support."
23 #endif 23 #endif
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // Encode |title| and |body| in url query in order to build the server 126 // Encode |title| and |body| in url query in order to build the server
127 // response later in TestRequestHandler. 127 // response later in TestRequestHandler.
128 std::string encoded_title = EncodeQueryParamValue(title); 128 std::string encoded_title = EncodeQueryParamValue(title);
129 url = net::AppendQueryParameter(url, kPageHtmlTitleParamName, encoded_title); 129 url = net::AppendQueryParameter(url, kPageHtmlTitleParamName, encoded_title);
130 std::string encoded_body = EncodeQueryParamValue(body); 130 std::string encoded_body = EncodeQueryParamValue(body);
131 url = net::AppendQueryParameter(url, kPageHtmlBodyParamName, encoded_body); 131 url = net::AppendQueryParameter(url, kPageHtmlBodyParamName, encoded_body);
132 132
133 return url; 133 return url;
134 } 134 }
135 135
136 void ChromeWebViewTest::LoadUrl(CWVWebView* web_view, NSURL* url) {
137 [web_view loadRequest:[NSURLRequest requestWithURL:url]];
138
139 WaitForPageLoadCompletion(web_view);
140 }
141
142 void ChromeWebViewTest::WaitForPageLoadCompletion(CWVWebView* web_view) {
143 BOOL success =
144 testing::WaitUntilConditionOrTimeout(testing::kWaitForPageLoadTimeout, ^{
145 return !web_view.isLoading;
146 });
147 ASSERT_TRUE(success);
148 }
149
150 } // namespace ios_web_view 136 } // namespace ios_web_view
OLDNEW
« no previous file with comments | « ios/web_view/test/chrome_web_view_test.h ('k') | ios/web_view/test/web_view_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698