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

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

Issue 2892193002: Add unittest to test CWVWebView. (Closed)
Patch Set: 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 #import "ios/web_view/test/chrome_web_view_test.h"
6
7 #import <ChromeWebView/ChromeWebView.h>
8 #import <Foundation/Foundation.h>
9
10 #import "ios/testing/wait_util.h"
11 #include "ios/web_view/test/test_server.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 #if !defined(__has_feature) || !__has_feature(objc_arc)
15 #error "This file requires ARC support."
16 #endif
17
18 ChromeWebViewTest::ChromeWebViewTest() {}
19
20 ChromeWebViewTest::~ChromeWebViewTest() = default;
21
22 void ChromeWebViewTest::SetUp() {
23 PlatformTest::SetUp();
24 ios_web_view::TestServer::Start();
Eugene But (OOO till 7-30) 2017/05/19 18:39:49 Can we be more consistent with ios_web_inttets and
michaeldo 2017/05/23 16:20:52 Unfortunately, I don't think so. See my comment in
25 }
26
27 void ChromeWebViewTest::TearDown() {
28 ios_web_view::TestServer::Shutdown();
29 PlatformTest::TearDown();
30 }
31
32 void ChromeWebViewTest::LoadURL(CWVWebView* web_view, NSURL* URL) {
33 [web_view loadRequest:[NSURLRequest requestWithURL:URL]];
34
35 WaitForPageLoadCompletion(web_view);
36 }
37
38 void ChromeWebViewTest::WaitForPageLoadCompletion(CWVWebView* web_view) {
39 BOOL success =
40 testing::WaitUntilConditionOrTimeout(testing::kWaitForPageLoadTimeout, ^{
41 return !web_view.isLoading;
42 });
43 EXPECT_TRUE(success);
Eugene But (OOO till 7-30) 2017/05/19 18:39:49 Should this be ASSERT_TRUE? There is no point in r
michaeldo 2017/05/23 16:20:52 You're right, changed to ASSERT_TRUE.
44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698