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

Unified Diff: ios/web/public/test/web_test.mm

Issue 2666953003: [ios] Automatically fail any WebTest whose render process crashes. (Closed)
Patch Set: Fix comment. 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/public/test/web_test.h ('k') | ios/web/public/web_state/global_web_state_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/public/test/web_test.mm
diff --git a/ios/web/public/test/web_test.mm b/ios/web/public/test/web_test.mm
index 773261d23a72cf2920de78274dcfe66c2521e112..e3525b9d81908ea5385c981e0665a06e9a29d1c3 100644
--- a/ios/web/public/test/web_test.mm
+++ b/ios/web/public/test/web_test.mm
@@ -6,11 +6,24 @@
#include "base/memory/ptr_util.h"
#include "ios/web/public/active_state_manager.h"
+#include "ios/web/public/web_state/global_web_state_observer.h"
#import "ios/web/public/test/fakes/test_web_client.h"
namespace web {
-WebTest::WebTest() : web_client_(base::WrapUnique(new TestWebClient)) {}
+class WebTestRenderProcessCrashObserver : public GlobalWebStateObserver {
+ public:
+ WebTestRenderProcessCrashObserver() = default;
+ ~WebTestRenderProcessCrashObserver() override = default;
+
+ void RenderProcessGone(WebState* web_state) override {
+ FAIL() << "Renderer process died unexpectedly during the test";
+ }
+};
+
+WebTest::WebTest()
+ : web_client_(base::WrapUnique(new TestWebClient)),
+ crash_observer_(base::MakeUnique<WebTestRenderProcessCrashObserver>()) {}
WebTest::~WebTest() {}
@@ -32,4 +45,12 @@ BrowserState* WebTest::GetBrowserState() {
return &browser_state_;
}
+void WebTest::SetIgnoreRenderProcessCrashesDuringTesting(bool allow) {
+ if (allow) {
+ crash_observer_ = nullptr;
+ } else {
+ crash_observer_ = base::MakeUnique<WebTestRenderProcessCrashObserver>();
+ }
+}
+
} // namespace web
« no previous file with comments | « ios/web/public/test/web_test.h ('k') | ios/web/public/web_state/global_web_state_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698