Change CefFrame::GetName() to return assigned name if it is non-empty before returning unique name (issue #2403)

This commit is contained in:
John Mayhew 2018-03-28 17:30:15 +00:00 committed by Marshall Greenblatt
parent bdc3b2a5ce
commit 6f88af7923
5 changed files with 108 additions and 27 deletions

View File

@ -214,7 +214,7 @@ CefRefPtr<CefFrame> CefBrowserImpl::GetFrame(const CefString& name) {
for (WebFrame* cur_frame = web_view->MainFrame(); cur_frame; for (WebFrame* cur_frame = web_view->MainFrame(); cur_frame;
cur_frame = cur_frame->TraverseNext()) { cur_frame = cur_frame->TraverseNext()) {
if (cur_frame->IsWebLocalFrame() && if (cur_frame->IsWebLocalFrame() &&
render_frame_util::GetUniqueName(cur_frame->ToWebLocalFrame()) == render_frame_util::GetName(cur_frame->ToWebLocalFrame()) ==
searchname) { searchname) {
frame = cur_frame; frame = cur_frame;
break; break;
@ -269,8 +269,7 @@ void CefBrowserImpl::GetFrameNames(std::vector<CefString>& names) {
for (WebFrame* frame = render_view()->GetWebView()->MainFrame(); frame; for (WebFrame* frame = render_view()->GetWebView()->MainFrame(); frame;
frame = frame->TraverseNext()) { frame = frame->TraverseNext()) {
if (frame->IsWebLocalFrame()) if (frame->IsWebLocalFrame())
names.push_back( names.push_back(render_frame_util::GetName(frame->ToWebLocalFrame()));
render_frame_util::GetUniqueName(frame->ToWebLocalFrame()));
} }
} }
} }
@ -356,7 +355,7 @@ CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl(
frame->Parent()->ToWebLocalFrame()) frame->Parent()->ToWebLocalFrame())
: webkit_glue::kInvalidFrameId; : webkit_glue::kInvalidFrameId;
const base::string16& name = const base::string16& name =
base::UTF8ToUTF16(render_frame_util::GetUniqueName(frame)); base::UTF8ToUTF16(render_frame_util::GetName(frame));
// Notify the browser that the frame has been identified. // Notify the browser that the frame has been identified.
Send(new CefHostMsg_FrameIdentified(routing_id(), frame_id, parent_id, name)); Send(new CefHostMsg_FrameIdentified(routing_id(), frame_id, parent_id, name));

View File

@ -188,7 +188,7 @@ CefString CefFrameImpl::GetName() {
CEF_REQUIRE_RT_RETURN(name); CEF_REQUIRE_RT_RETURN(name);
if (frame_) if (frame_)
name = render_frame_util::GetUniqueName(frame_); name = render_frame_util::GetName(frame_);
return name; return name;
} }

View File

@ -24,7 +24,14 @@ int64_t GetIdentifier(blink::WebLocalFrame* frame) {
return webkit_glue::kInvalidFrameId; return webkit_glue::kInvalidFrameId;
} }
std::string GetUniqueName(blink::WebLocalFrame* frame) { std::string GetName(blink::WebLocalFrame* frame) {
DCHECK(frame);
// Return the assigned name if it is non-empty. This represents the name
// property on the frame DOM element. If the assigned name is empty, revert to
// the internal unique name.
if (frame->AssignedName().length() > 0) {
return frame->AssignedName().Utf8();
}
content::RenderFrameImpl* render_frame = content::RenderFrameImpl* render_frame =
content::RenderFrameImpl::FromWebFrame(frame); content::RenderFrameImpl::FromWebFrame(frame);
DCHECK(render_frame); DCHECK(render_frame);

View File

@ -17,7 +17,7 @@ class WebLocalFrame;
namespace render_frame_util { namespace render_frame_util {
int64_t GetIdentifier(blink::WebLocalFrame* frame); int64_t GetIdentifier(blink::WebLocalFrame* frame);
std::string GetUniqueName(blink::WebLocalFrame* frame); std::string GetName(blink::WebLocalFrame* frame);
} // namespace render_frame_util } // namespace render_frame_util

View File

@ -95,11 +95,12 @@ const char kFrameNavMsg[] = "FrameTest.Navigation";
const char kFrameNavOrigin0[] = "http://tests-framenav0.com/"; const char kFrameNavOrigin0[] = "http://tests-framenav0.com/";
const char kFrameNavOrigin1[] = "http://tests-framenav1.com/"; const char kFrameNavOrigin1[] = "http://tests-framenav1.com/";
const char kFrameNavOrigin2[] = "http://tests-framenav2.com/"; const char kFrameNavOrigin2[] = "http://tests-framenav2.com/";
const char kFrameNavOrigin3[] = "http://tests-framenav3.com/";
// Maximum number of navigations. Should be kept synchronized with the number // Maximum number of navigations. Should be kept synchronized with the number
// of kFrameNavOrigin* values. Don't modify this value without checking the // of kFrameNavOrigin* values. Don't modify this value without checking the
// below use cases. // below use cases.
const int kMaxMultiNavNavigations = 3; const int kMaxMultiNavNavigations = 4;
// Global variables identifying the currently running test. // Global variables identifying the currently running test.
bool g_frame_nav_test = false; bool g_frame_nav_test = false;
@ -163,7 +164,7 @@ class FrameNavExpectations {
CompletionCallback completion_callback_; CompletionCallback completion_callback_;
}; };
// Browser process expectations abstact base class. // Browser process expectations abstract base class.
class FrameNavExpectationsBrowser : public FrameNavExpectations { class FrameNavExpectationsBrowser : public FrameNavExpectations {
public: public:
explicit FrameNavExpectationsBrowser(int nav) explicit FrameNavExpectationsBrowser(int nav)
@ -427,7 +428,7 @@ class FrameNavTestHandler : public TestHandler {
CreateBrowser(expectations_->GetMainURL()); CreateBrowser(expectations_->GetMainURL());
// Time out the test after a reasonable period of time. // Time out the test after a reasonable period of time.
SetTestTimeout(); SetTestTimeout(15000);
} }
// Transition to the next navigation. // Transition to the next navigation.
@ -1665,6 +1666,7 @@ namespace {
const char kFrame0Name[] = ""; const char kFrame0Name[] = "";
const char kFrame1Name[] = "nav2"; const char kFrame1Name[] = "nav2";
const char kFrame2Name[] = "<!--framePath //nav2/<!--frame0-->-->"; const char kFrame2Name[] = "<!--framePath //nav2/<!--frame0-->-->";
const char kFrame3Name[] = "nav3";
bool VerifyBrowserIframe(CefRefPtr<CefBrowser> browser, bool VerifyBrowserIframe(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame, CefRefPtr<CefFrame> frame,
@ -1672,11 +1674,11 @@ bool VerifyBrowserIframe(CefRefPtr<CefBrowser> browser,
int frame_number) { int frame_number) {
V_DECLARE(); V_DECLARE();
// frame0 contains frame1 contains frame2. // frame0 contains frame1 contains frame2, contains frame3.
CefRefPtr<CefFrame> frame0, frame1, frame2; CefRefPtr<CefFrame> frame0, frame1, frame2, frame3;
CefRefPtr<CefFrame> frame0b, frame1b, frame2b; CefRefPtr<CefFrame> frame0b, frame1b, frame2b, frame3b;
int64 frame0id, frame1id, frame2id; int64 frame0id, frame1id, frame2id, frame3id;
std::string frame0url, frame1url, frame2url; std::string frame0url, frame1url, frame2url, frame3url;
// Find frames by name. // Find frames by name.
frame0 = browser->GetFrame(kFrame0Name); frame0 = browser->GetFrame(kFrame0Name);
@ -1685,6 +1687,8 @@ bool VerifyBrowserIframe(CefRefPtr<CefBrowser> browser,
V_EXPECT_TRUE(frame1.get()); V_EXPECT_TRUE(frame1.get());
frame2 = browser->GetFrame(kFrame2Name); frame2 = browser->GetFrame(kFrame2Name);
V_EXPECT_TRUE(frame2.get()); V_EXPECT_TRUE(frame2.get());
frame3 = browser->GetFrame(kFrame3Name);
V_EXPECT_TRUE(frame3.get());
// Verify that the name matches. // Verify that the name matches.
V_EXPECT_TRUE(frame0->GetName().ToString() == kFrame0Name) V_EXPECT_TRUE(frame0->GetName().ToString() == kFrame0Name)
@ -1696,6 +1700,9 @@ bool VerifyBrowserIframe(CefRefPtr<CefBrowser> browser,
V_EXPECT_TRUE(frame2->GetName().ToString() == kFrame2Name) V_EXPECT_TRUE(frame2->GetName().ToString() == kFrame2Name)
<< "expected: " << kFrame2Name << "expected: " << kFrame2Name
<< " actual: " << frame2->GetName().ToString(); << " actual: " << frame2->GetName().ToString();
V_EXPECT_TRUE(frame3->GetName().ToString() == kFrame3Name)
<< "expected: " << kFrame3Name
<< " actual: " << frame3->GetName().ToString();
// Verify that the URL matches. // Verify that the URL matches.
frame0url = GetMultiNavURL(origin, 0); frame0url = GetMultiNavURL(origin, 0);
@ -1710,6 +1717,10 @@ bool VerifyBrowserIframe(CefRefPtr<CefBrowser> browser,
V_EXPECT_TRUE(frame2->GetURL() == frame2url) V_EXPECT_TRUE(frame2->GetURL() == frame2url)
<< "expected: " << frame2url << "expected: " << frame2url
<< " actual: " << frame2->GetURL().ToString(); << " actual: " << frame2->GetURL().ToString();
frame3url = GetMultiNavURL(origin, 3);
V_EXPECT_TRUE(frame3->GetURL() == frame3url)
<< "expected: " << frame3url
<< " actual: " << frame3->GetURL().ToString();
// Verify that the frame id is valid. // Verify that the frame id is valid.
frame0id = frame0->GetIdentifier(); frame0id = frame0->GetIdentifier();
@ -1718,6 +1729,8 @@ bool VerifyBrowserIframe(CefRefPtr<CefBrowser> browser,
V_EXPECT_TRUE(frame1id > 0) << "actual: " << frame1id; V_EXPECT_TRUE(frame1id > 0) << "actual: " << frame1id;
frame2id = frame2->GetIdentifier(); frame2id = frame2->GetIdentifier();
V_EXPECT_TRUE(frame2id > 0) << "actual: " << frame2id; V_EXPECT_TRUE(frame2id > 0) << "actual: " << frame2id;
frame3id = frame3->GetIdentifier();
V_EXPECT_TRUE(frame3id > 0) << "actual: " << frame3id;
// Verify that the current frame has the correct id. // Verify that the current frame has the correct id.
if (frame_number == 0) { if (frame_number == 0) {
@ -1729,6 +1742,9 @@ bool VerifyBrowserIframe(CefRefPtr<CefBrowser> browser,
} else if (frame_number == 2) { } else if (frame_number == 2) {
V_EXPECT_TRUE(frame->GetIdentifier() == frame2id) V_EXPECT_TRUE(frame->GetIdentifier() == frame2id)
<< "expected: " << frame2id << " actual: " << frame->GetIdentifier(); << "expected: " << frame2id << " actual: " << frame->GetIdentifier();
} else if (frame_number == 3) {
V_EXPECT_TRUE(frame->GetIdentifier() == frame3id)
<< "expected: " << frame3id << " actual: " << frame->GetIdentifier();
} }
// Find frames by id. // Find frames by id.
@ -1738,6 +1754,8 @@ bool VerifyBrowserIframe(CefRefPtr<CefBrowser> browser,
V_EXPECT_TRUE(frame1b.get()); V_EXPECT_TRUE(frame1b.get());
frame2b = browser->GetFrame(frame2->GetIdentifier()); frame2b = browser->GetFrame(frame2->GetIdentifier());
V_EXPECT_TRUE(frame2b.get()); V_EXPECT_TRUE(frame2b.get());
frame3b = browser->GetFrame(frame3->GetIdentifier());
V_EXPECT_TRUE(frame3b.get());
// Verify that the id matches. // Verify that the id matches.
V_EXPECT_TRUE(frame0b->GetIdentifier() == frame0id) V_EXPECT_TRUE(frame0b->GetIdentifier() == frame0id)
@ -1746,31 +1764,37 @@ bool VerifyBrowserIframe(CefRefPtr<CefBrowser> browser,
<< "expected: " << frame1id << " actual: " << frame1b->GetIdentifier(); << "expected: " << frame1id << " actual: " << frame1b->GetIdentifier();
V_EXPECT_TRUE(frame2b->GetIdentifier() == frame2id) V_EXPECT_TRUE(frame2b->GetIdentifier() == frame2id)
<< "expected: " << frame2id << " actual: " << frame2b->GetIdentifier(); << "expected: " << frame2id << " actual: " << frame2b->GetIdentifier();
V_EXPECT_TRUE(frame3b->GetIdentifier() == frame3id)
<< "expected: " << frame3id << " actual: " << frame3b->GetIdentifier();
size_t frame_count = browser->GetFrameCount(); size_t frame_count = browser->GetFrameCount();
V_EXPECT_TRUE(frame_count == 3U) << "actual: " << frame_count; V_EXPECT_TRUE(frame_count == 4U) << "actual: " << frame_count;
// Verify the GetFrameNames result. // Verify the GetFrameNames result.
std::vector<CefString> names; std::vector<CefString> names;
browser->GetFrameNames(names); browser->GetFrameNames(names);
V_EXPECT_TRUE(names.size() == 3U) << "actual: " << names.size(); V_EXPECT_TRUE(names.size() == 4U) << "actual: " << names.size();
V_EXPECT_TRUE(names[0].ToString() == kFrame0Name) V_EXPECT_TRUE(names[0].ToString() == kFrame0Name)
<< "expected: " << kFrame0Name << " actual: " << names[0].ToString(); << "expected: " << kFrame0Name << " actual: " << names[0].ToString();
V_EXPECT_TRUE(names[1].ToString() == kFrame1Name) V_EXPECT_TRUE(names[1].ToString() == kFrame1Name)
<< "expected: " << kFrame1Name << " actual: " << names[1].ToString(); << "expected: " << kFrame1Name << " actual: " << names[1].ToString();
V_EXPECT_TRUE(names[2].ToString() == kFrame2Name) V_EXPECT_TRUE(names[2].ToString() == kFrame2Name)
<< "expected: " << kFrame2Name << " actual: " << names[2].ToString(); << "expected: " << kFrame2Name << " actual: " << names[2].ToString();
V_EXPECT_TRUE(names[3].ToString() == kFrame3Name)
<< "expected: " << kFrame3Name << " actual: " << names[3].ToString();
// Verify the GetFrameIdentifiers result. // Verify the GetFrameIdentifiers result.
std::vector<int64> idents; std::vector<int64> idents;
browser->GetFrameIdentifiers(idents); browser->GetFrameIdentifiers(idents);
V_EXPECT_TRUE(idents.size() == 3U) << "actual: " << idents.size(); V_EXPECT_TRUE(idents.size() == 4U) << "actual: " << idents.size();
V_EXPECT_TRUE(idents[0] == frame0id) V_EXPECT_TRUE(idents[0] == frame0id)
<< "expected: " << frame0id << " actual: " << idents[0]; << "expected: " << frame0id << " actual: " << idents[0];
V_EXPECT_TRUE(idents[1] == frame1id) V_EXPECT_TRUE(idents[1] == frame1id)
<< "expected: " << frame1id << " actual: " << idents[1]; << "expected: " << frame1id << " actual: " << idents[1];
V_EXPECT_TRUE(idents[2] == frame2id) V_EXPECT_TRUE(idents[2] == frame2id)
<< "expected: " << frame2id << " actual: " << idents[2]; << "expected: " << frame2id << " actual: " << idents[2];
V_EXPECT_TRUE(idents[3] == frame3id)
<< "expected: " << frame3id << " actual: " << idents[3];
// Verify parent hierarchy. // Verify parent hierarchy.
V_EXPECT_FALSE(frame0->GetParent().get()); V_EXPECT_FALSE(frame0->GetParent().get());
@ -1780,6 +1804,9 @@ bool VerifyBrowserIframe(CefRefPtr<CefBrowser> browser,
V_EXPECT_TRUE(frame2->GetParent()->GetIdentifier() == frame1id) V_EXPECT_TRUE(frame2->GetParent()->GetIdentifier() == frame1id)
<< "expected: " << frame1id << "expected: " << frame1id
<< " actual: " << frame2->GetParent()->GetIdentifier(); << " actual: " << frame2->GetParent()->GetIdentifier();
V_EXPECT_TRUE(frame3->GetParent()->GetIdentifier() == frame2id)
<< "expected: " << frame2id
<< " actual: " << frame3->GetParent()->GetIdentifier();
V_RETURN(); V_RETURN();
} }
@ -1807,6 +1834,9 @@ class FrameNavExpectationsBrowserTestNestedIframes
case 2: case 2:
origin_ = kFrameNavOrigin2; origin_ = kFrameNavOrigin2;
break; break;
case 3:
origin_ = kFrameNavOrigin3;
break;
default: default:
EXPECT_TRUE(false); // Not reached. EXPECT_TRUE(false); // Not reached.
break; break;
@ -1830,9 +1860,21 @@ class FrameNavExpectationsBrowserTestNestedIframes
// Frame 1. Contains an unnamed iframe. // Frame 1. Contains an unnamed iframe.
return "<html><body>Nav2<iframe src=\"" + GetMultiNavURL(origin_, 2) + return "<html><body>Nav2<iframe src=\"" + GetMultiNavURL(origin_, 2) +
"\"></body></html>"; "\"></body></html>";
case 2: case 2: {
// Frame 2. // Frame 2. Contains an named iframe created via javascript.
return "<html><body>Nav3</body></html>"; std::stringstream ss;
ss << "<html><script>"
<< " function createFrame() {"
<< " var f = document.createElement('iframe');"
<< " f.name = 'nav3';"
<< " f.src = '" << GetMultiNavURL(origin_, 3) << "';"
<< " document.body.appendChild(f);"
<< " }</script><body onload=\"createFrame()\">Nav3</body></html>";
return ss.str();
}
case 3:
// Frame 3.
return "<html><body>Nav4</body></html>";
default: default:
EXPECT_TRUE(false); // Not reached. EXPECT_TRUE(false); // Not reached.
return ""; return "";
@ -1841,7 +1883,8 @@ class FrameNavExpectationsBrowserTestNestedIframes
bool IsNavigationDone() const override { bool IsNavigationDone() const override {
return got_load_state_change_done_ && got_renderer_complete_ && return got_load_state_change_done_ && got_renderer_complete_ &&
got_load_end_[0] && got_load_end_[1] && got_load_end_[2]; got_load_end_[0] && got_load_end_[1] && got_load_end_[2] &&
got_load_end_[3];
} }
bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser, bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
@ -1886,12 +1929,19 @@ class FrameNavExpectationsBrowserTestNestedIframes
if (frame_number == 0) { if (frame_number == 0) {
V_EXPECT_FALSE(got_load_start_[1]); V_EXPECT_FALSE(got_load_start_[1]);
V_EXPECT_FALSE(got_load_start_[2]); V_EXPECT_FALSE(got_load_start_[2]);
V_EXPECT_FALSE(got_load_start_[3]);
} else if (frame_number == 1) { } else if (frame_number == 1) {
V_EXPECT_TRUE(got_load_start_[0]); V_EXPECT_TRUE(got_load_start_[0]);
V_EXPECT_FALSE(got_load_start_[2]); V_EXPECT_FALSE(got_load_start_[2]);
V_EXPECT_FALSE(got_load_start_[3]);
} else if (frame_number == 2) { } else if (frame_number == 2) {
V_EXPECT_TRUE(got_load_start_[0]); V_EXPECT_TRUE(got_load_start_[0]);
V_EXPECT_TRUE(got_load_start_[1]); V_EXPECT_TRUE(got_load_start_[1]);
V_EXPECT_FALSE(got_load_start_[3]);
} else if (frame_number == 3) {
V_EXPECT_TRUE(got_load_start_[0]);
V_EXPECT_TRUE(got_load_start_[1]);
V_EXPECT_TRUE(got_load_start_[2]);
} else { } else {
V_EXPECT_TRUE(false); // Not reached. V_EXPECT_TRUE(false); // Not reached.
} }
@ -1914,12 +1964,19 @@ class FrameNavExpectationsBrowserTestNestedIframes
if (frame_number == 0) { if (frame_number == 0) {
V_EXPECT_TRUE(got_load_end_[1]); V_EXPECT_TRUE(got_load_end_[1]);
V_EXPECT_TRUE(got_load_end_[2]); V_EXPECT_TRUE(got_load_end_[2]);
V_EXPECT_TRUE(got_load_end_[3]);
} else if (frame_number == 1) { } else if (frame_number == 1) {
V_EXPECT_FALSE(got_load_end_[0]); V_EXPECT_FALSE(got_load_end_[0]);
V_EXPECT_TRUE(got_load_end_[2]); V_EXPECT_TRUE(got_load_end_[2]);
V_EXPECT_TRUE(got_load_end_[3]);
} else if (frame_number == 2) { } else if (frame_number == 2) {
V_EXPECT_FALSE(got_load_end_[0]); V_EXPECT_FALSE(got_load_end_[0]);
V_EXPECT_FALSE(got_load_end_[1]); V_EXPECT_FALSE(got_load_end_[1]);
V_EXPECT_TRUE(got_load_end_[3]);
} else if (frame_number == 3) {
V_EXPECT_FALSE(got_load_end_[0]);
V_EXPECT_FALSE(got_load_end_[1]);
V_EXPECT_FALSE(got_load_end_[2]);
} else { } else {
V_EXPECT_TRUE(false); // Not reached. V_EXPECT_TRUE(false); // Not reached.
} }
@ -1958,9 +2015,11 @@ class FrameNavExpectationsBrowserTestNestedIframes
V_EXPECT_TRUE(got_load_start_[0]); V_EXPECT_TRUE(got_load_start_[0]);
V_EXPECT_TRUE(got_load_start_[1]); V_EXPECT_TRUE(got_load_start_[1]);
V_EXPECT_TRUE(got_load_start_[2]); V_EXPECT_TRUE(got_load_start_[2]);
V_EXPECT_TRUE(got_load_start_[3]);
V_EXPECT_TRUE(got_load_end_[0]); V_EXPECT_TRUE(got_load_end_[0]);
V_EXPECT_TRUE(got_load_end_[1]); V_EXPECT_TRUE(got_load_end_[1]);
V_EXPECT_TRUE(got_load_end_[2]); V_EXPECT_TRUE(got_load_end_[2]);
V_EXPECT_TRUE(got_load_end_[3]);
V_EXPECT_TRUE(got_renderer_complete_); V_EXPECT_TRUE(got_renderer_complete_);
V_EXPECT_TRUE(parent::Finalize()); V_EXPECT_TRUE(parent::Finalize());
V_RETURN(); V_RETURN();
@ -1971,8 +2030,8 @@ class FrameNavExpectationsBrowserTestNestedIframes
std::string origin_; std::string origin_;
TrackCallback got_load_state_change_done_; TrackCallback got_load_state_change_done_;
TrackCallback got_load_start_[3]; TrackCallback got_load_start_[4];
TrackCallback got_load_end_[3]; TrackCallback got_load_end_[4];
TrackCallback got_renderer_complete_; TrackCallback got_renderer_complete_;
}; };
@ -1989,7 +2048,7 @@ class FrameNavExpectationsRendererTestNestedIframes
bool IsNavigationDone() const override { bool IsNavigationDone() const override {
return got_load_state_change_done_ && got_load_end_[0] && return got_load_state_change_done_ && got_load_end_[0] &&
got_load_end_[1] && got_load_end_[2]; got_load_end_[1] && got_load_end_[2] && got_load_end_[3];
} }
bool OnLoadingStateChange(CefRefPtr<CefBrowser> browser, bool OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
@ -2024,12 +2083,19 @@ class FrameNavExpectationsRendererTestNestedIframes
if (frame_number == 0) { if (frame_number == 0) {
V_EXPECT_FALSE(got_load_start_[1]); V_EXPECT_FALSE(got_load_start_[1]);
V_EXPECT_FALSE(got_load_start_[2]); V_EXPECT_FALSE(got_load_start_[2]);
V_EXPECT_FALSE(got_load_start_[3]);
} else if (frame_number == 1) { } else if (frame_number == 1) {
V_EXPECT_TRUE(got_load_start_[0]); V_EXPECT_TRUE(got_load_start_[0]);
V_EXPECT_FALSE(got_load_start_[2]); V_EXPECT_FALSE(got_load_start_[2]);
V_EXPECT_FALSE(got_load_start_[3]);
} else if (frame_number == 2) { } else if (frame_number == 2) {
V_EXPECT_TRUE(got_load_start_[0]); V_EXPECT_TRUE(got_load_start_[0]);
V_EXPECT_TRUE(got_load_start_[1]); V_EXPECT_TRUE(got_load_start_[1]);
V_EXPECT_FALSE(got_load_start_[3]);
} else if (frame_number == 3) {
V_EXPECT_TRUE(got_load_start_[0]);
V_EXPECT_TRUE(got_load_start_[1]);
V_EXPECT_TRUE(got_load_start_[2]);
} }
got_load_start_[frame_number].yes(); got_load_start_[frame_number].yes();
@ -2050,12 +2116,19 @@ class FrameNavExpectationsRendererTestNestedIframes
if (frame_number == 0) { if (frame_number == 0) {
V_EXPECT_TRUE(got_load_end_[1]); V_EXPECT_TRUE(got_load_end_[1]);
V_EXPECT_TRUE(got_load_end_[2]); V_EXPECT_TRUE(got_load_end_[2]);
V_EXPECT_TRUE(got_load_end_[3]);
} else if (frame_number == 1) { } else if (frame_number == 1) {
V_EXPECT_FALSE(got_load_end_[0]); V_EXPECT_FALSE(got_load_end_[0]);
V_EXPECT_TRUE(got_load_end_[2]); V_EXPECT_TRUE(got_load_end_[2]);
V_EXPECT_TRUE(got_load_end_[3]);
} else if (frame_number == 2) { } else if (frame_number == 2) {
V_EXPECT_FALSE(got_load_end_[0]); V_EXPECT_FALSE(got_load_end_[0]);
V_EXPECT_FALSE(got_load_end_[1]); V_EXPECT_FALSE(got_load_end_[1]);
V_EXPECT_TRUE(got_load_end_[3]);
} else if (frame_number == 3) {
V_EXPECT_FALSE(got_load_end_[0]);
V_EXPECT_FALSE(got_load_end_[1]);
V_EXPECT_FALSE(got_load_end_[2]);
} }
V_EXPECT_TRUE(VerifyBrowserIframe(browser, frame, origin_, frame_number)) V_EXPECT_TRUE(VerifyBrowserIframe(browser, frame, origin_, frame_number))
@ -2073,9 +2146,11 @@ class FrameNavExpectationsRendererTestNestedIframes
V_EXPECT_TRUE(got_load_start_[0]); V_EXPECT_TRUE(got_load_start_[0]);
V_EXPECT_TRUE(got_load_start_[1]); V_EXPECT_TRUE(got_load_start_[1]);
V_EXPECT_TRUE(got_load_start_[2]); V_EXPECT_TRUE(got_load_start_[2]);
V_EXPECT_TRUE(got_load_start_[3]);
V_EXPECT_TRUE(got_load_end_[0]); V_EXPECT_TRUE(got_load_end_[0]);
V_EXPECT_TRUE(got_load_end_[1]); V_EXPECT_TRUE(got_load_end_[1]);
V_EXPECT_TRUE(got_load_end_[2]); V_EXPECT_TRUE(got_load_end_[2]);
V_EXPECT_TRUE(got_load_end_[3]);
V_EXPECT_TRUE(parent::Finalize()); V_EXPECT_TRUE(parent::Finalize());
V_RETURN(); V_RETURN();
} }
@ -2084,8 +2159,8 @@ class FrameNavExpectationsRendererTestNestedIframes
std::string origin_; std::string origin_;
TrackCallback got_load_state_change_done_; TrackCallback got_load_state_change_done_;
TrackCallback got_load_start_[3]; TrackCallback got_load_start_[4];
TrackCallback got_load_end_[3]; TrackCallback got_load_end_[4];
}; };
class FrameNavExpectationsFactoryBrowserTestNestedIframesSameOrigin class FrameNavExpectationsFactoryBrowserTestNestedIframesSameOrigin