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

Side by Side Diff: ios/web/public/test/web_view_content_test_util.mm

Issue 2798773002: Create ChromeEarlGrey waitForWebViewContainingText. (Closed)
Patch Set: review comments Created 3 years, 6 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 unified diff | Download patch
OLDNEW
(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
OLDNEW
« no previous file with comments | « ios/web/public/test/web_view_content_test_util.h ('k') | ios/web/shell/test/context_menu_egtest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698