Add new FrameTest.* unit tests and fix discovered CefFrame-related bugs.

- Allow empty |name| argument to CefBrowser::GetFrame. This will return the main frame.
- Modify CefBrowser::GetFrame to search both assigned and unique frame names.
- Calling CefFrame::IsFocused on the main frame should return true when there are no other frames.
- Fix CefBrowser::GetFrameIdentifiers and GetFrameNames to return correct values in the renderer process (issue #1236).
- Delete NavigationTest.FrameNameIdent which is now obsoleted by the new FrameTests.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1842 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2014-09-24 15:38:11 +00:00
parent c17cd60630
commit 39ca06a66d
12 changed files with 2455 additions and 206 deletions

View File

@ -190,9 +190,17 @@ CefRefPtr<CefFrame> CefBrowserImpl::GetFrame(int64 identifier) {
CefRefPtr<CefFrame> CefBrowserImpl::GetFrame(const CefString& name) {
CEF_REQUIRE_RT_RETURN(NULL);
if (render_view()->GetWebView()) {
WebFrame* frame =
render_view()->GetWebView()->findFrameByName(name.ToString16());
blink::WebView* web_view = render_view()->GetWebView();
if (web_view) {
const blink::WebString& frame_name = name.ToString16();
// Search by assigned frame name (Frame::name).
WebFrame* frame = web_view->findFrameByName(frame_name,
web_view->mainFrame());
if (!frame) {
// Search by unique frame name (Frame::uniqueName).
frame = webkit_glue::FindFrameByUniqueName(frame_name,
web_view->mainFrame());
}
if (frame)
return GetWebFrameImpl(frame).get();
}
@ -222,6 +230,9 @@ size_t CefBrowserImpl::GetFrameCount() {
void CefBrowserImpl::GetFrameIdentifiers(std::vector<int64>& identifiers) {
CEF_REQUIRE_RT_RETURN_VOID();
if (identifiers.size() > 0)
identifiers.clear();
if (render_view()->GetWebView()) {
WebFrame* main_frame = render_view()->GetWebView()->mainFrame();
if (main_frame) {
@ -237,6 +248,9 @@ void CefBrowserImpl::GetFrameIdentifiers(std::vector<int64>& identifiers) {
void CefBrowserImpl::GetFrameNames(std::vector<CefString>& names) {
CEF_REQUIRE_RT_RETURN_VOID();
if (names.size() > 0)
names.clear();
if (render_view()->GetWebView()) {
WebFrame* main_frame = render_view()->GetWebView()->mainFrame();
if (main_frame) {