Index: ios/web/public/test/web_js_test.h |
diff --git a/ios/web/public/test/web_js_test.h b/ios/web/public/test/web_js_test.h |
index 74550e4de0784e1929b62adaee6b0345717b43c1..3785b05ecebf4f475a51263d5ab19e870cd4b5c0 100644 |
--- a/ios/web/public/test/web_js_test.h |
+++ b/ios/web/public/test/web_js_test.h |
@@ -20,7 +20,7 @@ template <class WebTestT> |
class WebJsTest : public WebTestT { |
public: |
WebJsTest(NSArray* java_script_paths) |
- : java_script_paths_([java_script_paths retain]) {} |
+ : java_script_paths_([java_script_paths copy]) {} |
protected: |
// Loads |html| and inject JavaScripts at |javaScriptPaths_|. |
@@ -60,11 +60,10 @@ class WebJsTest : public WebTestT { |
template <class WebTestT> |
void WebJsTest<WebTestT>::Inject() { |
- // Wait until main web injection has occured. |
- NSString* beacon = nil; |
- do { |
- beacon = WebTestT::EvaluateJavaScriptAsString(@"typeof __gCrWeb"); |
- } while (![beacon isEqualToString:@"object"]); |
+ // Main web injection should have occured. |
+ DCHECK_NSEQ(@"object", |
+ WebTestT::EvaluateJavaScriptAsString(@"typeof __gCrWeb")); |
+ |
for (NSString* java_script_path in java_script_paths_.get()) { |
NSString* path = |
[base::mac::FrameworkBundle() pathForResource:java_script_path |