| 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 #ifndef IOS_WEB_VIEW_TEST_CHROME_WEB_VIEW_TEST_H_ | 5 #ifndef IOS_WEB_VIEW_TEST_WEB_VIEW_TEST_H_ |
| 6 #define IOS_WEB_VIEW_TEST_CHROME_WEB_VIEW_TEST_H_ | 6 #define IOS_WEB_VIEW_TEST_WEB_VIEW_TEST_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #import "base/mac/scoped_nsobject.h" | 11 #import "base/mac/scoped_nsobject.h" |
| 12 #include "testing/platform_test.h" | 12 #include "testing/platform_test.h" |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 namespace test_server { | 15 namespace test_server { |
| 16 class EmbeddedTestServer; | 16 class EmbeddedTestServer; |
| 17 } // namespace test_server | 17 } // namespace test_server |
| 18 } // namespace net | 18 } // namespace net |
| 19 | 19 |
| 20 @class CWVWebView; | 20 @class CWVWebView; |
| 21 class GURL; | 21 class GURL; |
| 22 @class NSURL; | 22 @class NSURL; |
| 23 | 23 |
| 24 namespace ios_web_view { | 24 namespace ios_web_view { |
| 25 | 25 |
| 26 // A test fixture for testing CWVWebView. A test server is also created to | 26 // A test fixture for testing CWVWebView. A test server is also created to |
| 27 // support loading content. The server supports the urls returned by the GetUrl* | 27 // support loading content. The server supports the urls returned by the GetUrl* |
| 28 // methods below. | 28 // methods below. |
| 29 class ChromeWebViewTest : public PlatformTest { | 29 class WebViewTest : public PlatformTest { |
| 30 protected: | 30 protected: |
| 31 ChromeWebViewTest(); | 31 WebViewTest(); |
| 32 ~ChromeWebViewTest() override; | 32 ~WebViewTest() override; |
| 33 | 33 |
| 34 // Returns URL to an html page with title set to |title|. | 34 // Returns URL to an html page with title set to |title|. |
| 35 GURL GetUrlForPageWithTitle(const std::string& title); | 35 GURL GetUrlForPageWithTitle(const std::string& title); |
| 36 | 36 |
| 37 // Returns URL to an html page with |html| within page's body tags. | 37 // Returns URL to an html page with |html| within page's body tags. |
| 38 GURL GetUrlForPageWithHtmlBody(const std::string& html); | 38 GURL GetUrlForPageWithHtmlBody(const std::string& html); |
| 39 | 39 |
| 40 // Returns URL to an html page with title set to |title| and |body| within | 40 // Returns URL to an html page with title set to |title| and |body| within |
| 41 // the page's body tags. | 41 // the page's body tags. |
| 42 GURL GetUrlForPageWithTitleAndBody(const std::string& title, | 42 GURL GetUrlForPageWithTitleAndBody(const std::string& title, |
| 43 const std::string& body); | 43 const std::string& body); |
| 44 | 44 |
| 45 // PlatformTest methods. | 45 // PlatformTest methods. |
| 46 void SetUp() override; | 46 void SetUp() override; |
| 47 | 47 |
| 48 // CWVWebView created with default configuration and frame equal to screen | 48 // CWVWebView created with default configuration and frame equal to screen |
| 49 // bounds. | 49 // bounds. |
| 50 base::scoped_nsobject<CWVWebView> web_view_; | 50 base::scoped_nsobject<CWVWebView> web_view_; |
| 51 | 51 |
| 52 // Embedded server for handling requests sent to the URLs returned by the | 52 // Embedded server for handling requests sent to the URLs returned by the |
| 53 // GetURL* methods. | 53 // GetURL* methods. |
| 54 std::unique_ptr<net::test_server::EmbeddedTestServer> test_server_; | 54 std::unique_ptr<net::test_server::EmbeddedTestServer> test_server_; |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 } // namespace ios_web_view | 57 } // namespace ios_web_view |
| 58 | 58 |
| 59 #endif // IOS_WEB_VIEW_TEST_CHROME_WEB_VIEW_TEST_H_ | 59 #endif // IOS_WEB_VIEW_TEST_WEB_VIEW_TEST_H_ |
| OLD | NEW |