Commit f1fb5938 authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Chromium LUCI CQ

[iOS] Fix test with Error Page enabled

This CL fixes the audio test when the new error page workflow is
enabled.
It was failing because the LoadHtml method is triggering the WebState
callbacks twice, letting the delegate_ receiving empty data for the
first callback.

Bug: 1152364
Change-Id: I6e6a4d196e0381d7388981a4ecb5f086543396a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2593092
Auto-Submit: Gauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarAli Juma <ajuma@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#837502}
parent 3a8ef4a5
......@@ -5,6 +5,7 @@
#import "ios/chrome/browser/voice/text_to_speech_listener.h"
#include "ios/web/public/test/web_test_with_web_state.h"
#import "ios/web/public/test/web_view_content_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/gtest_mac.h"
......@@ -70,6 +71,13 @@ class TextToSpeechListenerTest : public web::WebTestWithWebState {
public:
void SetUp() override {
web::WebTestWithWebState::SetUp();
// Load Html is triggering several callbacks when called the first time.
// Call it a first time before setting the |delegate_| to make sure that it
// is working as expected in tests.
LoadHtml(@"<html><body>Page loaded</body></html>");
ASSERT_TRUE(
web::test::WaitForWebViewContainingText(web_state(), "Page loaded"));
delegate_ = [[TestTTSListenerDelegate alloc] init];
listener_ = [[TextToSpeechListener alloc] initWithWebState:web_state()
delegate:delegate_];
......
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