| OLD | NEW | 
| (Empty) |  | 
 |   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 | 
 |   3 // found in the LICENSE file. | 
 |   4  | 
 |   5 #import "ios/web/public/test/web_view_content_test_util.h" | 
 |   6  | 
 |   7 #import <Foundation/Foundation.h> | 
 |   8  | 
 |   9 #import "ios/web/public/test/web_view_interaction_test_util.h" | 
 |  10  | 
 |  11 namespace { | 
 |  12 // Script that returns document.body as a string. | 
 |  13 char kGetDocumentBodyJavaScript[] = | 
 |  14     "document.body ? document.body.textContent : null"; | 
 |  15 } | 
 |  16  | 
 |  17 namespace web { | 
 |  18 namespace test { | 
 |  19  | 
 |  20 bool IsWebViewContainingText(web::WebState* web_state, | 
 |  21                              const std::string& text) { | 
 |  22   std::unique_ptr<base::Value> value = | 
 |  23       web::test::ExecuteJavaScript(web_state, kGetDocumentBodyJavaScript); | 
 |  24   std::string body; | 
 |  25   if (value && value->GetAsString(&body)) { | 
 |  26     return body.find(text) != std::string::npos; | 
 |  27   } | 
 |  28   return false; | 
 |  29 } | 
 |  30  | 
 |  31 }  // namespace test | 
 |  32 }  // namespace web | 
| OLD | NEW |