OLD | NEW |
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" |
| 14 #import "ios/web_view/test/web_view_test_util.h" |
14 #include "net/base/url_util.h" | 15 #include "net/base/url_util.h" |
15 #include "net/test/embedded_test_server/embedded_test_server.h" | 16 #include "net/test/embedded_test_server/embedded_test_server.h" |
16 #include "net/test/embedded_test_server/http_request.h" | 17 #include "net/test/embedded_test_server/http_request.h" |
17 #include "net/test/embedded_test_server/http_response.h" | 18 #include "net/test/embedded_test_server/http_response.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
19 | 20 |
20 #if !defined(__has_feature) || !__has_feature(objc_arc) | 21 #if !defined(__has_feature) || !__has_feature(objc_arc) |
21 #error "This file requires ARC support." | 22 #error "This file requires ARC support." |
22 #endif | 23 #endif |
23 | 24 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 return CreatePageHTMLResponse(title, body); | 91 return CreatePageHTMLResponse(title, body); |
91 } | 92 } |
92 return nullptr; | 93 return nullptr; |
93 } | 94 } |
94 | 95 |
95 } // namespace | 96 } // namespace |
96 | 97 |
97 namespace ios_web_view { | 98 namespace ios_web_view { |
98 | 99 |
99 ChromeWebViewTest::ChromeWebViewTest() | 100 ChromeWebViewTest::ChromeWebViewTest() |
100 : test_server_(base::MakeUnique<net::EmbeddedTestServer>( | 101 : web_view_(test::CreateWebView()), |
| 102 test_server_(base::MakeUnique<net::EmbeddedTestServer>( |
101 net::test_server::EmbeddedTestServer::TYPE_HTTP)) { | 103 net::test_server::EmbeddedTestServer::TYPE_HTTP)) { |
102 test_server_->RegisterRequestHandler(base::Bind(&TestRequestHandler)); | 104 test_server_->RegisterRequestHandler(base::Bind(&TestRequestHandler)); |
103 } | 105 } |
104 | 106 |
105 ChromeWebViewTest::~ChromeWebViewTest() = default; | 107 ChromeWebViewTest::~ChromeWebViewTest() = default; |
106 | 108 |
107 void ChromeWebViewTest::SetUp() { | 109 void ChromeWebViewTest::SetUp() { |
108 PlatformTest::SetUp(); | 110 PlatformTest::SetUp(); |
109 ASSERT_TRUE(test_server_->Start()); | 111 ASSERT_TRUE(test_server_->Start()); |
110 } | 112 } |
(...skipping 28 matching lines...) Expand all Loading... |
139 | 141 |
140 void ChromeWebViewTest::WaitForPageLoadCompletion(CWVWebView* web_view) { | 142 void ChromeWebViewTest::WaitForPageLoadCompletion(CWVWebView* web_view) { |
141 BOOL success = | 143 BOOL success = |
142 testing::WaitUntilConditionOrTimeout(testing::kWaitForPageLoadTimeout, ^{ | 144 testing::WaitUntilConditionOrTimeout(testing::kWaitForPageLoadTimeout, ^{ |
143 return !web_view.isLoading; | 145 return !web_view.isLoading; |
144 }); | 146 }); |
145 ASSERT_TRUE(success); | 147 ASSERT_TRUE(success); |
146 } | 148 } |
147 | 149 |
148 } // namespace ios_web_view | 150 } // namespace ios_web_view |
OLD | NEW |