| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" | 7 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
| 8 #include "chrome/browser/renderer_context_menu/render_view_context_menu_browsert
est_util.h" | 8 #include "chrome/browser/renderer_context_menu/render_view_context_menu_browsert
est_util.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 content::WebContents* tab = | 123 content::WebContents* tab = |
| 124 browser()->tab_strip_model()->GetActiveWebContents(); | 124 browser()->tab_strip_model()->GetActiveWebContents(); |
| 125 | 125 |
| 126 EXPECT_NO_FATAL_FAILURE(LoadTestPageAndWaitForMouseOver(tab)); | 126 EXPECT_NO_FATAL_FAILURE(LoadTestPageAndWaitForMouseOver(tab)); |
| 127 | 127 |
| 128 ContextMenuWaiter menu_observer(content::NotificationService::AllSources()); | 128 ContextMenuWaiter menu_observer(content::NotificationService::AllSources()); |
| 129 ui_controls::SendMouseClick(ui_controls::RIGHT); | 129 ui_controls::SendMouseClick(ui_controls::RIGHT); |
| 130 // Wait until the context menu is opened and closed. | 130 // Wait until the context menu is opened and closed. |
| 131 menu_observer.WaitForMenuOpenAndClose(); | 131 menu_observer.WaitForMenuOpenAndClose(); |
| 132 | 132 |
| 133 tab->GetMainFrame()->ExecuteJavaScript(base::ASCIIToUTF16("done()")); | 133 tab->GetMainFrame()->ExecuteJavaScriptForTests(base::ASCIIToUTF16("done()")); |
| 134 const base::string16 success_title = base::ASCIIToUTF16("without mouseleave"); | 134 const base::string16 success_title = base::ASCIIToUTF16("without mouseleave"); |
| 135 const base::string16 failure_title = base::ASCIIToUTF16("with mouseleave"); | 135 const base::string16 failure_title = base::ASCIIToUTF16("with mouseleave"); |
| 136 content::TitleWatcher done_title_watcher(tab, success_title); | 136 content::TitleWatcher done_title_watcher(tab, success_title); |
| 137 done_title_watcher.AlsoWaitForTitle(failure_title); | 137 done_title_watcher.AlsoWaitForTitle(failure_title); |
| 138 | 138 |
| 139 EXPECT_EQ(success_title, done_title_watcher.WaitAndGetTitle()); | 139 EXPECT_EQ(success_title, done_title_watcher.WaitAndGetTitle()); |
| 140 } | 140 } |
| 141 | 141 |
| 142 #if defined(OS_WIN) || defined(OS_MACOSX) | 142 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 143 // Test that a mouseleave is not triggered when showing a modal dialog. | 143 // Test that a mouseleave is not triggered when showing a modal dialog. |
| 144 // Sample regression: crbug.com/394672 | 144 // Sample regression: crbug.com/394672 |
| 145 // TODO: Make test pass on OS_WIN and OS_MACOSX | 145 // TODO: Make test pass on OS_WIN and OS_MACOSX |
| 146 // OS_WIN: http://crbug.com/450138 | 146 // OS_WIN: http://crbug.com/450138 |
| 147 // OS_MACOSX: Missing automation provider support: http://crbug.com/45892. | 147 // OS_MACOSX: Missing automation provider support: http://crbug.com/45892. |
| 148 #define MAYBE_ModalDialog DISABLED_ModalDialog | 148 #define MAYBE_ModalDialog DISABLED_ModalDialog |
| 149 #else | 149 #else |
| 150 #define MAYBE_ModalDialog ModalDialog | 150 #define MAYBE_ModalDialog ModalDialog |
| 151 #endif | 151 #endif |
| 152 | 152 |
| 153 IN_PROC_BROWSER_TEST_F(MouseLeaveTest, MAYBE_ModalDialog) { | 153 IN_PROC_BROWSER_TEST_F(MouseLeaveTest, MAYBE_ModalDialog) { |
| 154 content::WebContents* tab = | 154 content::WebContents* tab = |
| 155 browser()->tab_strip_model()->GetActiveWebContents(); | 155 browser()->tab_strip_model()->GetActiveWebContents(); |
| 156 | 156 |
| 157 EXPECT_NO_FATAL_FAILURE(LoadTestPageAndWaitForMouseOver(tab)); | 157 EXPECT_NO_FATAL_FAILURE(LoadTestPageAndWaitForMouseOver(tab)); |
| 158 | 158 |
| 159 tab->GetMainFrame()->ExecuteJavaScript(base::UTF8ToUTF16("alert()")); | 159 tab->GetMainFrame()->ExecuteJavaScriptForTests(base::UTF8ToUTF16("alert()")); |
| 160 app_modal::AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); | 160 app_modal::AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); |
| 161 // Cancel the dialog. | 161 // Cancel the dialog. |
| 162 alert->CloseModalDialog(); | 162 alert->CloseModalDialog(); |
| 163 | 163 |
| 164 tab->GetMainFrame()->ExecuteJavaScript(base::ASCIIToUTF16("done()")); | 164 tab->GetMainFrame()->ExecuteJavaScriptForTests(base::ASCIIToUTF16("done()")); |
| 165 const base::string16 success_title = base::ASCIIToUTF16("without mouseleave"); | 165 const base::string16 success_title = base::ASCIIToUTF16("without mouseleave"); |
| 166 const base::string16 failure_title = base::ASCIIToUTF16("with mouseleave"); | 166 const base::string16 failure_title = base::ASCIIToUTF16("with mouseleave"); |
| 167 content::TitleWatcher done_title_watcher(tab, success_title); | 167 content::TitleWatcher done_title_watcher(tab, success_title); |
| 168 done_title_watcher.AlsoWaitForTitle(failure_title); | 168 done_title_watcher.AlsoWaitForTitle(failure_title); |
| 169 EXPECT_EQ(success_title, done_title_watcher.WaitAndGetTitle()); | 169 EXPECT_EQ(success_title, done_title_watcher.WaitAndGetTitle()); |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace | 172 } // namespace |
| OLD | NEW |