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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web_view/test/chrome_web_view_test.h
diff --git a/ios/web_view/test/chrome_web_view_test.h b/ios/web_view/test/chrome_web_view_test.h
new file mode 100644
index 0000000000000000000000000000000000000000..5605a64976d6fb15cf8f0f8ef1a0975d9c3cc571
--- /dev/null
+++ b/ios/web_view/test/chrome_web_view_test.h
@@ -0,0 +1,58 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_WEB_VIEW_TEST_CHROME_WEB_VIEW_TEST_H_
+#define IOS_WEB_VIEW_TEST_CHROME_WEB_VIEW_TEST_H_
+
+#include <memory>
+#include <string>
+
+#include "testing/platform_test.h"
+
+namespace net {
+namespace test_server {
+class EmbeddedTestServer;
+} // namespace test_server
+} // namespace net
+
+@class CWVWebView;
+class GURL;
+@class NSURL;
+
+namespace ios_web_view {
+
+// A test fixture for testing CWVWebView. A test server is also created to
+// support loading content. The server supports the urls defined by
+// RegisterDefaultHandlers in net/test/embedded_test_server/default_handlers.h
+// as well as urls returned by the GetUrl* methods below.
+class ChromeWebViewTest : public PlatformTest {
+ protected:
+ ChromeWebViewTest();
+ ~ChromeWebViewTest() override;
+
+ // Returns URL to an html page with title set to |title|.
+ GURL GetUrlForPageWithTitle(const std::string& title);
+
+ // Returns URL to an html page with |html| within page's body tags.
+ GURL GetUrlForPageWithHTMLBody(const std::string& html);
+
+ // Loads |URL| in |web_view| and waits until the load completes. Asserts if
+ // loading does not complete.
+ void LoadUrl(CWVWebView* web_view, NSURL* url);
+
+ // Waits until |web_view| stops loading. Asserts if loading does not complete.
+ void WaitForPageLoadCompletion(CWVWebView* web_view);
+
+ // PlatformTest methods.
+ void SetUp() override;
+
+ // Embedded server for handling responses to urls as registered by
+ // net/test/embedded_test_server/default_handlers.h and the GetURLForPageWith*
+ // methods.
+ std::unique_ptr<net::test_server::EmbeddedTestServer> test_server_;
+};
+
+} // namespace ios_web_view
+
+#endif // IOS_WEB_VIEW_TEST_CHROME_WEB_VIEW_TEST_H_
« 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