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

Unified Diff: ios/web/web_state/ui/crw_web_controller_unittest.mm

Issue 2645783002: Replaced webControllerWebProcessDidCrash: with RenderProcessGone. (Closed)
Patch Set: Created 3 years, 11 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/web_state/ui/crw_web_controller.mm ('k') | ios/web/web_state/web_state_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/ui/crw_web_controller_unittest.mm
diff --git a/ios/web/web_state/ui/crw_web_controller_unittest.mm b/ios/web/web_state/ui/crw_web_controller_unittest.mm
index 836bd30191964e44752f565d9674adc385f11f02..364580c4a571f74b2164b67b8e8b2c3b3e787cac 100644
--- a/ios/web/web_state/ui/crw_web_controller_unittest.mm
+++ b/ios/web/web_state/ui/crw_web_controller_unittest.mm
@@ -1022,18 +1022,31 @@ class CRWWebControllerWebProcessTest : public web::WebTestWithWebController {
base::scoped_nsobject<WKWebView> webView_;
};
-// Tests that -[CRWWebDelegate webControllerWebProcessDidCrash:] is called
-// when WKWebView web process has crashed.
+// Tests that WebStateDelegate::RenderProcessGone is called when WKWebView web
+// process has crashed.
TEST_F(CRWWebControllerWebProcessTest, Crash) {
- id delegate = [OCMockObject niceMockForProtocol:@protocol(CRWWebDelegate)];
- [[delegate expect] webControllerWebProcessDidCrash:web_controller()];
+ // Observes and waits for RenderProcessGone call.
+ class RenderProcessGoneObserver : public web::WebStateObserver {
+ public:
+ explicit RenderProcessGoneObserver(web::WebState* web_state)
+ : web::WebStateObserver(web_state) {}
+ void WaitForRenderProcessGone() const {
+ base::test::ios::WaitUntilCondition(^{
+ return render_process_gone_;
+ });
+ }
+ // WebStateObserver overrides:
+ void RenderProcessGone() override { render_process_gone_ = true; }
- [web_controller() setDelegate:delegate];
+ private:
+ bool render_process_gone_ = false;
+ };
+
+ RenderProcessGoneObserver observer(web_state());
web::SimulateWKWebViewCrash(webView_);
+ observer.WaitForRenderProcessGone();
- EXPECT_OCMOCK_VERIFY(delegate);
EXPECT_FALSE([web_controller() isViewAlive]);
- [web_controller() setDelegate:nil];
};
} // namespace
« no previous file with comments | « ios/web/web_state/ui/crw_web_controller.mm ('k') | ios/web/web_state/web_state_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698