| Index: ios/web/public/test/web_view_content_test_util.mm
 | 
| diff --git a/ios/web/public/test/web_view_content_test_util.mm b/ios/web/public/test/web_view_content_test_util.mm
 | 
| new file mode 100644
 | 
| index 0000000000000000000000000000000000000000..850cf76c47482337e017bf96b89818f36577db8e
 | 
| --- /dev/null
 | 
| +++ b/ios/web/public/test/web_view_content_test_util.mm
 | 
| @@ -0,0 +1,31 @@
 | 
| +// Copyright 2017 The Chromium Authors. All rights reserved.
 | 
| +// Use of this source code is governed by a BSD-style license that can be
 | 
| +// found in the LICENSE file.
 | 
| +
 | 
| +#import "ios/web/public/test/web_view_content_test_util.h"
 | 
| +
 | 
| +#import <Foundation/Foundation.h>
 | 
| +
 | 
| +#import "ios/web/public/test/web_view_interaction_test_util.h"
 | 
| +
 | 
| +namespace {
 | 
| +// Script that returns document.body as a string.
 | 
| +char kGetDocumentBodyJavaScript[] =
 | 
| +    "document.body ? document.body.textContent : null";
 | 
| +}
 | 
| +
 | 
| +namespace web {
 | 
| +namespace test {
 | 
| +
 | 
| +bool WebViewContainingText(web::WebState* web_state, const std::string& text) {
 | 
| +  std::unique_ptr<base::Value> value =
 | 
| +      web::test::ExecuteJavaScript(web_state, kGetDocumentBodyJavaScript);
 | 
| +  std::string body;
 | 
| +  if (value && value->GetAsString(&body)) {
 | 
| +    return body.find(text) != std::string::npos;
 | 
| +  }
 | 
| +  return false;
 | 
| +}
 | 
| +
 | 
| +}  // namespace test
 | 
| +}  // namespace web
 | 
| 
 |