diff options
-rw-r--r-- | chrome/browser/browser_focus_uitest.cc | 38 | ||||
-rw-r--r-- | chrome/test/base/ui_test_utils.cc | 12 | ||||
-rw-r--r-- | chrome/test/base/ui_test_utils.h | 7 | ||||
-rw-r--r-- | content/browser/renderer_host/render_view_host.cc | 8 | ||||
-rw-r--r-- | content/browser/renderer_host/render_view_host.h | 1 | ||||
-rw-r--r-- | content/browser/tab_contents/tab_contents.cc | 8 | ||||
-rw-r--r-- | content/browser/tab_contents/tab_contents.h | 1 | ||||
-rw-r--r-- | content/public/browser/notification_types.h | 5 |
8 files changed, 21 insertions, 59 deletions
diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc index a71111c..9108dfd 100644 --- a/chrome/browser/browser_focus_uitest.cc +++ b/chrome/browser/browser_focus_uitest.cc @@ -26,7 +26,6 @@ #include "content/browser/tab_contents/interstitial_page.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" -#include "content/common/view_messages.h" #include "content/public/browser/notification_service.h" #include "net/test/test_server.h" @@ -64,9 +63,9 @@ #define MAYBE_TabsRememberFocusFindInPage FAILS_TabsRememberFocusFindInPage #elif defined(OS_WIN) // Disabled, http://crbug.com/62543. -#define MAYBE_FocusTraversal DISABLED_FocusTraversal +#define MAYBE_FocusTraversal FocusTraversal // Disabled, http://crbug.com/62544. -#define MAYBE_FocusTraversalOnInterstitial DISABLED_FocusTraversalOnInterstitial +#define MAYBE_FocusTraversalOnInterstitial FocusTraversalOnInterstitial // Flaky, http://crbug.com/62537. #define MAYBE_TabsRememberFocusFindInPage FLAKY_TabsRememberFocusFindInPage #endif @@ -173,23 +172,6 @@ class TestInterstitialPage : public InterstitialPage { return render_view_host()->view()->HasFocus(); } - protected: - bool OnMessageReceived(const IPC::Message& message) { - bool handled = true; - IPC_BEGIN_MESSAGE_MAP(TestInterstitialPage, message) - IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) - IPC_MESSAGE_UNHANDLED(handled = false) - IPC_END_MESSAGE_MAP() - return handled; - } - - void OnFocusedNodeChanged(bool is_editable_node) { - content::NotificationService::current()->Notify( - content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, - content::Source<TabContents>(tab()), - content::Details<const bool>(&is_editable_node)); - } - private: std::string html_contents_; }; @@ -511,8 +493,8 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversal) { ASSERT_TRUE(ui_test_utils::SendKeyPressAndWaitWithDetails( browser(), ui::VKEY_TAB, false, false, false, false, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, - content::NotificationSource(content::Source<TabContents>( - browser()->GetSelectedTabContents())), + content::NotificationSource(content::Source<RenderViewHost>( + browser()->GetSelectedTabContents()->render_view_host())), details)); } else { // On the last tab key press, the focus returns to the browser. @@ -554,8 +536,8 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversal) { ASSERT_TRUE(ui_test_utils::SendKeyPressAndWaitWithDetails( browser(), ui::VKEY_TAB, false, true, false, false, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, - content::NotificationSource(content::Source<TabContents>( - browser()->GetSelectedTabContents())), + content::NotificationSource(content::Source<RenderViewHost>( + browser()->GetSelectedTabContents()->render_view_host())), details)); } else { // On the last tab key press, the focus returns to the browser. @@ -638,8 +620,8 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversalOnInterstitial) { content::NotificationService::AllSources(); if (j < arraysize(kExpElementIDs) - 1) { notification_type = content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE; - notification_source = content::Source<TabContents>( - interstitial_page->tab()); + notification_source = content::Source<RenderViewHost>( + interstitial_page->render_view_host()); } else { // On the last tab key press, the focus returns to the browser. notification_type = chrome::NOTIFICATION_FOCUS_RETURNED_TO_BROWSER; @@ -673,8 +655,8 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversalOnInterstitial) { content::NotificationService::AllSources(); if (j < arraysize(kExpElementIDs) - 1) { notification_type = content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE; - notification_source = content::Source<TabContents>( - interstitial_page->tab()); + notification_source = content::Source<RenderViewHost>( + interstitial_page->render_view_host()); } else { // On the last tab key press, the focus returns to the browser. notification_type = chrome::NOTIFICATION_FOCUS_RETURNED_TO_BROWSER; diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc index 75531f2..6f2a5ce 100644 --- a/chrome/test/base/ui_test_utils.cc +++ b/chrome/test/base/ui_test_utils.cc @@ -549,18 +549,6 @@ void CrashTab(TabContents* tab) { content::Source<content::RenderProcessHost>(rph)); } -void WaitForFocusChange(TabContents* tab_contents) { - TestNotificationObserver observer; - RegisterAndWait(&observer, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, - content::Source<TabContents>(tab_contents)); -} - -void WaitForFocusInBrowser(Browser* browser) { - TestNotificationObserver observer; - RegisterAndWait(&observer, chrome::NOTIFICATION_FOCUS_RETURNED_TO_BROWSER, - content::Source<Browser>(browser)); -} - int FindInPage(TabContentsWrapper* tab_contents, const string16& search_string, bool forward, bool match_case, int* ordinal) { tab_contents-> diff --git a/chrome/test/base/ui_test_utils.h b/chrome/test/base/ui_test_utils.h index 85afd44..4fce446 100644 --- a/chrome/test/base/ui_test_utils.h +++ b/chrome/test/base/ui_test_utils.h @@ -194,13 +194,6 @@ AppModalDialog* WaitForAppModalDialog(); // Causes the specified tab to crash. Blocks until it is crashed. void CrashTab(TabContents* tab); -// Waits for the focus to change in the specified tab. -void WaitForFocusChange(TabContents* tab_contents); - -// Waits for the renderer to return focus to the browser (happens through tab -// traversal). -void WaitForFocusInBrowser(Browser* browser); - // Performs a find in the page of the specified tab. Returns the number of // matches found. |ordinal| is an optional parameter which is set to the index // of the current match. diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc index 3b539a3..d177462 100644 --- a/content/browser/renderer_host/render_view_host.cc +++ b/content/browser/renderer_host/render_view_host.cc @@ -712,6 +712,7 @@ bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) IPC_MESSAGE_HANDLER(DragHostMsg_TargetDrop_ACK, OnTargetDropACK) IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) + IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole) IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnMsgShouldCloseACK) IPC_MESSAGE_HANDLER(ViewHostMsg_ClosePage_ACK, OnMsgClosePageACK) @@ -1131,6 +1132,13 @@ void RenderViewHost::OnTakeFocus(bool reverse) { view->TakeFocus(reverse); } +void RenderViewHost::OnFocusedNodeChanged(bool is_editable_node) { + content::NotificationService::current()->Notify( + content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, + content::Source<RenderViewHost>(this), + content::Details<const bool>(&is_editable_node)); +} + void RenderViewHost::OnAddMessageToConsole(int32 level, const string16& message, int32 line_no, diff --git a/content/browser/renderer_host/render_view_host.h b/content/browser/renderer_host/render_view_host.h index 1375e67..99cc989 100644 --- a/content/browser/renderer_host/render_view_host.h +++ b/content/browser/renderer_host/render_view_host.h @@ -564,6 +564,7 @@ class CONTENT_EXPORT RenderViewHost : public RenderWidgetHost { void OnUpdateDragCursor(WebKit::WebDragOperation drag_operation); void OnTargetDropACK(); void OnTakeFocus(bool reverse); + void OnFocusedNodeChanged(bool is_editable_node); void OnAddMessageToConsole(int32 level, const string16& message, int32 line_no, diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index 9176a5e..e716148 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -315,7 +315,6 @@ bool TabContents::OnMessageReceived(const IPC::Message& message) { OnUpdateContentRestrictions) IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) - IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) IPC_MESSAGE_HANDLER(ViewHostMsg_SaveURLAs, OnSaveURL) IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) IPC_MESSAGE_HANDLER(ViewHostMsg_JSOutOfMemory, OnJSOutOfMemory) @@ -1152,13 +1151,6 @@ void TabContents::OnUpdateZoomLimits(int minimum_percent, temporary_zoom_settings_ = !remember; } -void TabContents::OnFocusedNodeChanged(bool is_editable_node) { - content::NotificationService::current()->Notify( - content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, - content::Source<TabContents>(this), - content::Details<const bool>(&is_editable_node)); -} - void TabContents::OnEnumerateDirectory(int request_id, const FilePath& path) { delegate()->EnumerateDirectory(this, request_id, path); diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index 78a6952..7fa48b9 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -642,7 +642,6 @@ class CONTENT_EXPORT TabContents : public PageNavigator, void OnUpdateZoomLimits(int minimum_percent, int maximum_percent, bool remember); - void OnFocusedNodeChanged(bool is_editable_node); void OnEnumerateDirectory(int request_id, const FilePath& path); void OnJSOutOfMemory(); void OnRegisterProtocolHandler(const std::string& protocol, diff --git a/content/public/browser/notification_types.h b/content/public/browser/notification_types.h index 970a50e..51c64c3 100644 --- a/content/public/browser/notification_types.h +++ b/content/public/browser/notification_types.h @@ -357,9 +357,8 @@ enum NotificationType { NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, // The focused element inside a page has changed. The source is the - // TabContents containing the render view host for the page. The details is - // a Details<const bool> that indicates whether or not an editable node was - // focused. + // RenderViewHost. The details is a Details<const bool> that indicates whether + // or not an editable node was focused. NOTIFICATION_FOCUS_CHANGED_IN_PAGE, // Notification posted from ExecuteJavascriptInWebFrameNotifyResult. The |