OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "ios/web/web_state/ui/crw_web_controller.h" | 5 #import "ios/web/web_state/ui/crw_web_controller.h" |
6 | 6 |
7 #import <WebKit/WebKit.h> | 7 #import <WebKit/WebKit.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 class CRWWebControllerWebProcessTest : public web::WebTestWithWebController { | 1006 class CRWWebControllerWebProcessTest : public web::WebTestWithWebController { |
1007 protected: | 1007 protected: |
1008 void SetUp() override { | 1008 void SetUp() override { |
1009 web::WebTestWithWebController::SetUp(); | 1009 web::WebTestWithWebController::SetUp(); |
1010 webView_.reset([web::BuildTerminatedWKWebView() retain]); | 1010 webView_.reset([web::BuildTerminatedWKWebView() retain]); |
1011 base::scoped_nsobject<TestWebViewContentView> webViewContentView( | 1011 base::scoped_nsobject<TestWebViewContentView> webViewContentView( |
1012 [[TestWebViewContentView alloc] | 1012 [[TestWebViewContentView alloc] |
1013 initWithMockWebView:webView_ | 1013 initWithMockWebView:webView_ |
1014 scrollView:[webView_ scrollView]]); | 1014 scrollView:[webView_ scrollView]]); |
1015 [web_controller() injectWebViewContentView:webViewContentView]; | 1015 [web_controller() injectWebViewContentView:webViewContentView]; |
| 1016 |
| 1017 // This test intentionally crashes the render process. |
| 1018 SetIgnoreRenderProcessCrashesDuringTesting(true); |
1016 } | 1019 } |
1017 base::scoped_nsobject<WKWebView> webView_; | 1020 base::scoped_nsobject<WKWebView> webView_; |
1018 }; | 1021 }; |
1019 | 1022 |
1020 // Tests that WebStateDelegate::RenderProcessGone is called when WKWebView web | 1023 // Tests that WebStateDelegate::RenderProcessGone is called when WKWebView web |
1021 // process has crashed. | 1024 // process has crashed. |
1022 TEST_F(CRWWebControllerWebProcessTest, Crash) { | 1025 TEST_F(CRWWebControllerWebProcessTest, Crash) { |
1023 // Observes and waits for RenderProcessGone call. | 1026 // Observes and waits for RenderProcessGone call. |
1024 class RenderProcessGoneObserver : public web::WebStateObserver { | 1027 class RenderProcessGoneObserver : public web::WebStateObserver { |
1025 public: | 1028 public: |
(...skipping 12 matching lines...) Expand all Loading... |
1038 }; | 1041 }; |
1039 | 1042 |
1040 RenderProcessGoneObserver observer(web_state()); | 1043 RenderProcessGoneObserver observer(web_state()); |
1041 web::SimulateWKWebViewCrash(webView_); | 1044 web::SimulateWKWebViewCrash(webView_); |
1042 observer.WaitForRenderProcessGone(); | 1045 observer.WaitForRenderProcessGone(); |
1043 | 1046 |
1044 EXPECT_FALSE([web_controller() isViewAlive]); | 1047 EXPECT_FALSE([web_controller() isViewAlive]); |
1045 }; | 1048 }; |
1046 | 1049 |
1047 } // namespace | 1050 } // namespace |
OLD | NEW |