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

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

Issue 2892193002: Add unittest to test CWVWebView. (Closed)
Patch Set: Respond to comments. Created 3 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef IOS_WEB_VIEW_TEST_CHROME_WEB_VIEW_TEST_H_
6 #define IOS_WEB_VIEW_TEST_CHROME_WEB_VIEW_TEST_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "testing/platform_test.h"
12
13 namespace net {
14 namespace test_server {
15 class EmbeddedTestServer;
16 } // namespace test_server
17 } // namespace net
18
19 @class CWVWebView;
20 class GURL;
21 @class NSURL;
22
23 namespace ios_web_view {
24
25 // A test fixture for testing CWVWebView. A test server is also created to
26 // support loading content. The server supports the urls defined by
27 // RegisterDefaultHandlers in net/test/embedded_test_server/default_handlers.h
28 // as well as urls returned by the GetUrl* methods below.
29 class ChromeWebViewTest : public PlatformTest {
30 protected:
31 ChromeWebViewTest();
32 ~ChromeWebViewTest() override;
33
34 // Returns URL to an html page with title set to |title|.
35 GURL GetUrlForPageWithTitle(const std::string& title);
36
37 // Returns URL to an html page with |html| within page's body tags.
38 GURL GetUrlForPageWithHTMLBody(const std::string& html);
39
40 // Loads |URL| in |web_view| and waits until the load completes. Asserts if
41 // loading does not complete.
42 void LoadUrl(CWVWebView* web_view, NSURL* url);
43
44 // Waits until |web_view| stops loading. Asserts if loading does not complete.
45 void WaitForPageLoadCompletion(CWVWebView* web_view);
46
47 // PlatformTest methods.
48 void SetUp() override;
49
50 // Embedded server for handling responses to urls as registered by
51 // net/test/embedded_test_server/default_handlers.h and the GetURLForPageWith*
52 // methods.
53 std::unique_ptr<net::test_server::EmbeddedTestServer> test_server_;
54 };
55
56 } // namespace ios_web_view
57
58 #endif // IOS_WEB_VIEW_TEST_CHROME_WEB_VIEW_TEST_H_
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.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698