OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <utility> | 5 #include <utility> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 EXPECT_TRUE(WaitForLoadStop(popup)); | 257 EXPECT_TRUE(WaitForLoadStop(popup)); |
258 EXPECT_EQ(popup_url, popup->GetLastCommittedURL()); | 258 EXPECT_EQ(popup_url, popup->GetLastCommittedURL()); |
259 EXPECT_NE(popup, web_contents); | 259 EXPECT_NE(popup, web_contents); |
260 | 260 |
261 // Switch focus to the original tab, since opening a popup also focused it. | 261 // Switch focus to the original tab, since opening a popup also focused it. |
262 web_contents->GetDelegate()->ActivateContents(web_contents); | 262 web_contents->GetDelegate()->ActivateContents(web_contents); |
263 EXPECT_EQ(web_contents, browser()->tab_strip_model()->GetActiveWebContents()); | 263 EXPECT_EQ(web_contents, browser()->tab_strip_model()->GetActiveWebContents()); |
264 | 264 |
265 // Focus the popup via window.focus(). | 265 // Focus the popup via window.focus(). |
266 content::DOMMessageQueue queue; | 266 content::DOMMessageQueue queue; |
267 EXPECT_TRUE(ExecuteScript(web_contents, "focusPopup()")); | 267 ExecuteScriptAsync(web_contents, "focusPopup()"); |
268 | 268 |
269 // Wait for main page to lose focus and for popup to gain focus. Each event | 269 // Wait for main page to lose focus and for popup to gain focus. Each event |
270 // will send a message, and the two messages can arrive in any order. | 270 // will send a message, and the two messages can arrive in any order. |
271 std::string status; | 271 std::string status; |
272 bool main_lost_focus = false; | 272 bool main_lost_focus = false; |
273 bool popup_got_focus = false; | 273 bool popup_got_focus = false; |
274 while (queue.WaitForMessage(&status)) { | 274 while (queue.WaitForMessage(&status)) { |
275 if (status == "\"main-lost-focus\"") | 275 if (status == "\"main-lost-focus\"") |
276 main_lost_focus = true; | 276 main_lost_focus = true; |
277 if (status == "\"popup-got-focus\"") | 277 if (status == "\"popup-got-focus\"") |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 TestSpellCheckPanelHost* host = | 850 TestSpellCheckPanelHost* host = |
851 browser_client.GetTestSpellCheckPanelHostForProcess( | 851 browser_client.GetTestSpellCheckPanelHostForProcess( |
852 cross_site_subframe->GetProcess()); | 852 cross_site_subframe->GetProcess()); |
853 EXPECT_TRUE(host->SpellingPanelVisible()); | 853 EXPECT_TRUE(host->SpellingPanelVisible()); |
854 | 854 |
855 content::SetBrowserClientForTesting(old_browser_client); | 855 content::SetBrowserClientForTesting(old_browser_client); |
856 } | 856 } |
857 #endif // BUILDFLAG(HAS_SPELLCHECK_PANEL) | 857 #endif // BUILDFLAG(HAS_SPELLCHECK_PANEL) |
858 | 858 |
859 #endif // BUILDFLAG(ENABLE_SPELLCHECK) | 859 #endif // BUILDFLAG(ENABLE_SPELLCHECK) |
OLD | NEW |