Index: ios/web/public/test/earl_grey/web_view_matchers.mm |
diff --git a/ios/web/public/test/earl_grey/web_view_matchers.mm b/ios/web/public/test/earl_grey/web_view_matchers.mm |
index 24504095af9b1001ec0e0f6e5796bf116f43ac1f..a2b55504e7cb3f85a9abe7d9b635ec23f751349d 100644 |
--- a/ios/web/public/test/earl_grey/web_view_matchers.mm |
+++ b/ios/web/public/test/earl_grey/web_view_matchers.mm |
@@ -4,10 +4,9 @@ |
#import "ios/web/public/test/earl_grey/web_view_matchers.h" |
-#include <memory> |
- |
#import <WebKit/WebKit.h> |
+#include "base/logging.h" |
#include "base/mac/bind_objc_block.h" |
#include "base/strings/stringprintf.h" |
#include "base/strings/sys_string_conversions.h" |
@@ -15,6 +14,10 @@ |
#include "base/test/ios/wait_util.h" |
#include "base/values.h" |
#include "ios/testing/earl_grey/wait_util.h" |
+#import "ios/web/public/test/web_view_interaction_test_util.h" |
Eugene But (OOO till 7-30)
2016/08/30 18:11:05
Do you need this include?
marq (ping after 24h)
2016/08/31 13:07:58
Yes, that's where ExecuteScript was moved to.
|
+#include "ios/web/web_state/web_state_impl.h" |
Eugene But (OOO till 7-30)
2016/08/30 18:11:05
Do you need to import web_state_impl? Maybe import
marq (ping after 24h)
2016/08/31 13:07:58
Correct, I needed it at one point but not now.
|
+ |
+using web::test::ExecuteScript; |
namespace { |
@@ -24,34 +27,6 @@ char kGetDocumentBodyJavaScript[] = |
// Script that tests presence of css selector. |
char kTestCssSelectorJavaScriptTemplate[] = "!!document.querySelector(\"%s\");"; |
-// Synchronously returns the result of executed JavaScript. |
-std::unique_ptr<base::Value> ExecuteScript(web::WebState* web_state, |
- const std::string& script) { |
- __block std::unique_ptr<base::Value> result; |
- __block bool did_finish = false; |
- web_state->ExecuteJavaScript(base::UTF8ToUTF16(script), |
- base::BindBlock(^(const base::Value* value) { |
- if (value) |
- result = value->CreateDeepCopy(); |
- did_finish = true; |
- })); |
- |
- testing::WaitUntilCondition(testing::kWaitForJSCompletionTimeout, ^{ |
- return did_finish; |
- }); |
- |
- // As result is marked __block, this return call does a copy and not a move |
- // (marking the variable as __block mean it is allocated in the block object |
- // and not the stack). Since the "return std::move()" pattern is discouraged |
- // use a local variable. |
- // |
- // Fixes the following compilation failure: |
- // ../web_view_matchers.mm:ll:cc: error: call to implicitly-deleted copy |
- // constructor of 'std::unique_ptr<base::Value>' |
- std::unique_ptr<base::Value> stack_result = std::move(result); |
- return stack_result; |
-} |
- |
} // namespace |
namespace web { |