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

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

Issue 2920303003: [ObjC ARC] Converts ios/web/public/test:test to ARC. (Closed)
Patch Set: unsafe_unretained 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/web/public/test/web_view_interaction_test_util.h" 5 #import "ios/web/public/test/web_view_interaction_test_util.h"
6 6
7 #import "base/mac/bind_objc_block.h" 7 #import "base/mac/bind_objc_block.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #import "base/test/ios/wait_util.h" 10 #import "base/test/ios/wait_util.h"
11 #import "ios/testing/wait_util.h" 11 #import "ios/testing/wait_util.h"
12 #import "ios/web/public/web_state/ui/crw_web_view_scroll_view_proxy.h" 12 #import "ios/web/public/web_state/ui/crw_web_view_scroll_view_proxy.h"
13 #import "ios/web/web_state/ui/crw_web_controller.h" 13 #import "ios/web/web_state/ui/crw_web_controller.h"
14 #import "ios/web/web_state/ui/crw_web_view_proxy_impl.h" 14 #import "ios/web/web_state/ui/crw_web_view_proxy_impl.h"
15 #import "ios/web/web_state/web_state_impl.h" 15 #import "ios/web/web_state/web_state_impl.h"
16 16
17 #if !defined(__has_feature) || !__has_feature(objc_arc)
18 #error "This file requires ARC support."
19 #endif
20
17 using web::NavigationManager; 21 using web::NavigationManager;
18 22
19 namespace web { 23 namespace web {
20 namespace test { 24 namespace test {
21 25
22 enum ElementAction { 26 enum ElementAction {
23 ELEMENT_ACTION_CLICK, 27 ELEMENT_ACTION_CLICK,
24 ELEMENT_ACTION_FOCUS, 28 ELEMENT_ACTION_FOCUS,
25 ELEMENT_ACTION_SUBMIT 29 ELEMENT_ACTION_SUBMIT
26 }; 30 };
27 31
28 std::unique_ptr<base::Value> ExecuteJavaScript(web::WebState* web_state, 32 std::unique_ptr<base::Value> ExecuteJavaScript(web::WebState* web_state,
29 const std::string& script) { 33 const std::string& script) {
30 __block std::unique_ptr<base::Value> result; 34 __block std::unique_ptr<base::Value> result;
31 __block bool did_finish = false; 35 __block bool did_finish = false;
32 web_state->ExecuteJavaScript(base::UTF8ToUTF16(script), 36 web_state->ExecuteJavaScript(base::UTF8ToUTF16(script),
33 base::BindBlock(^(const base::Value* value) { 37 base::BindBlockArc(^(const base::Value* value) {
34 if (value) 38 if (value)
35 result = value->CreateDeepCopy(); 39 result = value->CreateDeepCopy();
36 did_finish = true; 40 did_finish = true;
37 })); 41 }));
38 42
39 bool completed = testing::WaitUntilConditionOrTimeout( 43 bool completed = testing::WaitUntilConditionOrTimeout(
40 testing::kWaitForJSCompletionTimeout, ^{ 44 testing::kWaitForJSCompletionTimeout, ^{
41 return did_finish; 45 return did_finish;
42 }); 46 });
43 if (!completed) { 47 if (!completed) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } 176 }
173 177
174 bool SubmitWebViewFormWithId(web::WebState* web_state, 178 bool SubmitWebViewFormWithId(web::WebState* web_state,
175 const std::string& form_id) { 179 const std::string& form_id) {
176 return RunActionOnWebViewElementWithId(web_state, form_id, 180 return RunActionOnWebViewElementWithId(web_state, form_id,
177 ELEMENT_ACTION_SUBMIT); 181 ELEMENT_ACTION_SUBMIT);
178 } 182 }
179 183
180 } // namespace test 184 } // namespace test
181 } // namespace web 185 } // namespace web
OLDNEW
« ios/web/public/test/js_test_util.h ('K') | « ios/web/public/test/web_test_with_web_state.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698