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

Side by Side Diff: ios/web/test/web_test_unittest.mm

Issue 2934083002: [ObjC ARC] Converts ios/web:ios_web_general_unittests to ARC. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « ios/web/history_state_util_unittest.mm ('k') | ios/web/url_scheme_util_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <WebKit/WebKit.h> 5 #import <WebKit/WebKit.h>
6 6
7 #import "ios/web/public/test/fakes/test_web_view_content_view.h" 7 #import "ios/web/public/test/fakes/test_web_view_content_view.h"
8 #import "ios/web/test/web_test_with_web_controller.h" 8 #import "ios/web/test/web_test_with_web_controller.h"
9 #import "ios/web/test/wk_web_view_crash_utils.h" 9 #import "ios/web/test/wk_web_view_crash_utils.h"
10 #include "testing/gtest/include/gtest/gtest-spi.h" 10 #include "testing/gtest/include/gtest/gtest-spi.h"
11 11
12 #if !defined(__has_feature) || !__has_feature(objc_arc)
13 #error "This file requires ARC support."
14 #endif
15
12 namespace { 16 namespace {
13 17
14 // Fixture to test that the WebTest fixture properly fails tests when the render 18 // Fixture to test that the WebTest fixture properly fails tests when the render
15 // process crashes. 19 // process crashes.
16 class WebTestFixtureTest : public web::WebTestWithWebController { 20 class WebTestFixtureTest : public web::WebTestWithWebController {
17 protected: 21 protected:
18 void SetUp() override { 22 void SetUp() override {
19 web::WebTestWithWebController::SetUp(); 23 web::WebTestWithWebController::SetUp();
20 web_view_.reset([web::BuildTerminatedWKWebView() retain]); 24 web_view_ = web::BuildTerminatedWKWebView();
21 base::scoped_nsobject<TestWebViewContentView> web_view_content_view( 25 TestWebViewContentView* web_view_content_view =
22 [[TestWebViewContentView alloc] 26 [[TestWebViewContentView alloc]
23 initWithMockWebView:web_view_ 27 initWithMockWebView:web_view_
24 scrollView:[web_view_ scrollView]]); 28 scrollView:[web_view_ scrollView]];
25 [web_controller() injectWebViewContentView:web_view_content_view]; 29 [web_controller() injectWebViewContentView:web_view_content_view];
26 } 30 }
27 31
28 base::scoped_nsobject<WKWebView> web_view_; 32 WKWebView* web_view_;
29 }; 33 };
30 34
31 // Tests that the WebTest fixture triggers a test failure when a render process 35 // Tests that the WebTest fixture triggers a test failure when a render process
32 // crashes during the test. 36 // crashes during the test.
33 TEST_F(WebTestFixtureTest, FailsOnRenderCrash) { 37 TEST_F(WebTestFixtureTest, FailsOnRenderCrash) {
34 // EXPECT_FATAL_FAILURE() uses a local class, which cannot access non-static 38 // EXPECT_FATAL_FAILURE() uses a local class, which cannot access non-static
35 // variables of the enclosing function. 39 // variables of the enclosing function.
36 static WKWebView* web_view = web_view_; 40 static WKWebView* web_view = web_view_;
37 41
38 EXPECT_FATAL_FAILURE(web::SimulateWKWebViewCrash(web_view), 42 EXPECT_FATAL_FAILURE(web::SimulateWKWebViewCrash(web_view),
39 "Renderer process died unexpectedly"); 43 "Renderer process died unexpectedly");
40 }; 44 };
41 45
42 // Tests that |SetIgnoreRenderProcessCrashesDuringTesting()| properly ignores 46 // Tests that |SetIgnoreRenderProcessCrashesDuringTesting()| properly ignores
43 // intentional render process crashes. 47 // intentional render process crashes.
44 TEST_F(WebTestFixtureTest, SucceedsOnRenderCrash) { 48 TEST_F(WebTestFixtureTest, SucceedsOnRenderCrash) {
45 SetIgnoreRenderProcessCrashesDuringTesting(true); 49 SetIgnoreRenderProcessCrashesDuringTesting(true);
46 web::SimulateWKWebViewCrash(web_view_); 50 web::SimulateWKWebViewCrash(web_view_);
47 }; 51 };
48 52
49 } // namespace 53 } // namespace
OLDNEW
« no previous file with comments | « ios/web/history_state_util_unittest.mm ('k') | ios/web/url_scheme_util_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698