Commit 7647e35b authored by eugenebut's avatar eugenebut Committed by Commit bot

[ios] Moved ASSERT_TRUE out of block in WebStateTest.ScriptExecution.

ASSERT_TRUE stops test execution by retuning, which will not stop the
test if return is called from the block.

BUG=678942

Review-Url: https://codereview.chromium.org/2611283003
Cr-Commit-Position: refs/heads/master@{#442014}
parent 62430eb9
...@@ -603,15 +603,17 @@ TEST_F(WebStateTest, ScriptExecution) { ...@@ -603,15 +603,17 @@ TEST_F(WebStateTest, ScriptExecution) {
// Execute script with callback. // Execute script with callback.
__block std::unique_ptr<base::Value> execution_result; __block std::unique_ptr<base::Value> execution_result;
__block bool execution_complete = false;
web_state_->ExecuteJavaScript(base::UTF8ToUTF16("window.foo"), web_state_->ExecuteJavaScript(base::UTF8ToUTF16("window.foo"),
base::BindBlock(^(const base::Value* value) { base::BindBlock(^(const base::Value* value) {
ASSERT_TRUE(value);
execution_result = value->CreateDeepCopy(); execution_result = value->CreateDeepCopy();
execution_complete = true;
})); }));
base::test::ios::WaitUntilCondition(^bool() { base::test::ios::WaitUntilCondition(^{
return execution_result.get(); return execution_complete;
}); });
ASSERT_TRUE(execution_result);
std::string string_result; std::string string_result;
execution_result->GetAsString(&string_result); execution_result->GetAsString(&string_result);
EXPECT_EQ("bar", string_result); EXPECT_EQ("bar", string_result);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment