mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-23 15:37:51 +01:00
Fix test flakyness in renderer process OnLoadingStateChange history state
This commit is contained in:
parent
9e644b7538
commit
57fb011377
@ -429,10 +429,6 @@ void CefBrowserImpl::OnDestruct() {
|
|||||||
CefContentRendererClient::Get()->OnBrowserDestroyed(this);
|
CefContentRendererClient::Get()->OnBrowserDestroyed(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::DidStartLoading() {
|
|
||||||
OnLoadingStateChange(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefBrowserImpl::DidStopLoading() {
|
void CefBrowserImpl::DidStopLoading() {
|
||||||
OnLoadingStateChange(false);
|
OnLoadingStateChange(false);
|
||||||
}
|
}
|
||||||
@ -458,6 +454,9 @@ void CefBrowserImpl::DidFailProvisionalLoad(blink::WebLocalFrame* frame,
|
|||||||
|
|
||||||
void CefBrowserImpl::DidCommitProvisionalLoad(blink::WebLocalFrame* frame,
|
void CefBrowserImpl::DidCommitProvisionalLoad(blink::WebLocalFrame* frame,
|
||||||
bool is_new_navigation) {
|
bool is_new_navigation) {
|
||||||
|
if (frame->Parent() == nullptr) {
|
||||||
|
OnLoadingStateChange(true);
|
||||||
|
}
|
||||||
OnLoadStart(frame);
|
OnLoadStart(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,6 @@ class CefBrowserImpl : public CefBrowser, public content::RenderViewObserver {
|
|||||||
|
|
||||||
// RenderViewObserver methods.
|
// RenderViewObserver methods.
|
||||||
void OnDestruct() override;
|
void OnDestruct() override;
|
||||||
void DidStartLoading() override;
|
|
||||||
void DidStopLoading() override;
|
void DidStopLoading() override;
|
||||||
void DidFailProvisionalLoad(blink::WebLocalFrame* frame,
|
void DidFailProvisionalLoad(blink::WebLocalFrame* frame,
|
||||||
const blink::WebURLError& error) override;
|
const blink::WebURLError& error) override;
|
||||||
|
@ -1027,13 +1027,8 @@ class FrameNavExpectationsRendererTestSingleNav
|
|||||||
bool isLoading) override {
|
bool isLoading) override {
|
||||||
V_DECLARE();
|
V_DECLARE();
|
||||||
// A frame should always exist in the renderer process.
|
// A frame should always exist in the renderer process.
|
||||||
if (isLoading) {
|
|
||||||
V_EXPECT_TRUE(
|
|
||||||
VerifySingleBrowserFrames(browser, NULL, true, std::string()));
|
|
||||||
} else {
|
|
||||||
V_EXPECT_TRUE(
|
V_EXPECT_TRUE(
|
||||||
VerifySingleBrowserFrames(browser, NULL, true, kFrameNavOrigin0));
|
VerifySingleBrowserFrames(browser, NULL, true, kFrameNavOrigin0));
|
||||||
}
|
|
||||||
V_EXPECT_TRUE(parent::OnLoadingStateChange(browser, isLoading));
|
V_EXPECT_TRUE(parent::OnLoadingStateChange(browser, isLoading));
|
||||||
V_RETURN();
|
V_RETURN();
|
||||||
}
|
}
|
||||||
@ -1572,16 +1567,7 @@ class FrameNavExpectationsRendererTestMultiNav
|
|||||||
got_load_state_change_done_.yes();
|
got_load_state_change_done_.yes();
|
||||||
V_DECLARE();
|
V_DECLARE();
|
||||||
// A frame should always exist in the renderer process.
|
// A frame should always exist in the renderer process.
|
||||||
if (isLoading) {
|
V_EXPECT_TRUE(VerifySingleBrowserFrames(browser, NULL, true, GetMainURL()));
|
||||||
std::string expected_url;
|
|
||||||
if (nav() > 0)
|
|
||||||
expected_url = GetPreviousMainURL();
|
|
||||||
V_EXPECT_TRUE(
|
|
||||||
VerifySingleBrowserFrames(browser, NULL, true, expected_url));
|
|
||||||
} else {
|
|
||||||
V_EXPECT_TRUE(
|
|
||||||
VerifySingleBrowserFrames(browser, NULL, true, GetMainURL()));
|
|
||||||
}
|
|
||||||
V_EXPECT_TRUE(parent::OnLoadingStateChange(browser, isLoading));
|
V_EXPECT_TRUE(parent::OnLoadingStateChange(browser, isLoading));
|
||||||
V_RETURN();
|
V_RETURN();
|
||||||
}
|
}
|
||||||
|
@ -105,33 +105,21 @@ class HistoryNavRendererTest : public ClientAppRenderer::Delegate,
|
|||||||
const NavListItem& item = kHNavList[nav_];
|
const NavListItem& item = kHNavList[nav_];
|
||||||
|
|
||||||
const std::string& url = browser->GetMainFrame()->GetURL();
|
const std::string& url = browser->GetMainFrame()->GetURL();
|
||||||
if (isLoading) {
|
|
||||||
got_loading_state_start_.yes();
|
|
||||||
|
|
||||||
EXPECT_STRNE(item.target, url.c_str());
|
|
||||||
|
|
||||||
if (nav_ > 0) {
|
|
||||||
const NavListItem& last_item = kHNavList[nav_ - 1];
|
|
||||||
EXPECT_EQ(last_item.can_go_back, browser->CanGoBack());
|
|
||||||
EXPECT_EQ(last_item.can_go_back, canGoBack);
|
|
||||||
EXPECT_EQ(last_item.can_go_forward, browser->CanGoForward());
|
|
||||||
EXPECT_EQ(last_item.can_go_forward, canGoForward);
|
|
||||||
} else {
|
|
||||||
EXPECT_FALSE(browser->CanGoBack());
|
|
||||||
EXPECT_FALSE(canGoBack);
|
|
||||||
EXPECT_FALSE(browser->CanGoForward());
|
|
||||||
EXPECT_FALSE(canGoForward);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
got_loading_state_end_.yes();
|
|
||||||
|
|
||||||
EXPECT_STREQ(item.target, url.c_str());
|
EXPECT_STREQ(item.target, url.c_str());
|
||||||
|
|
||||||
EXPECT_EQ(item.can_go_back, browser->CanGoBack());
|
EXPECT_EQ(item.can_go_back, browser->CanGoBack())
|
||||||
EXPECT_EQ(item.can_go_back, canGoBack);
|
<< "nav: " << nav_ << " isLoading: " << isLoading;
|
||||||
EXPECT_EQ(item.can_go_forward, browser->CanGoForward());
|
EXPECT_EQ(item.can_go_back, canGoBack)
|
||||||
EXPECT_EQ(item.can_go_forward, canGoForward);
|
<< "nav: " << nav_ << " isLoading: " << isLoading;
|
||||||
|
EXPECT_EQ(item.can_go_forward, browser->CanGoForward())
|
||||||
|
<< "nav: " << nav_ << " isLoading: " << isLoading;
|
||||||
|
EXPECT_EQ(item.can_go_forward, canGoForward)
|
||||||
|
<< "nav: " << nav_ << " isLoading: " << isLoading;
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
got_loading_state_start_.yes();
|
||||||
|
} else {
|
||||||
|
got_loading_state_end_.yes();
|
||||||
SendTestResultsIfDone(browser);
|
SendTestResultsIfDone(browser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user