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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 230 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
231 | 231 |
232 chrome::FocusLocationBar(browser()); | 232 chrome::FocusLocationBar(browser()); |
233 ASSERT_TRUE(IsViewFocused(VIEW_ID_OMNIBOX)); | 233 ASSERT_TRUE(IsViewFocused(VIEW_ID_OMNIBOX)); |
234 // Hide the window, show it again, the focus should not have changed. | 234 // Hide the window, show it again, the focus should not have changed. |
235 ui_test_utils::HideNativeWindow(window); | 235 ui_test_utils::HideNativeWindow(window); |
236 ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(window)); | 236 ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(window)); |
237 ASSERT_TRUE(IsViewFocused(VIEW_ID_OMNIBOX)); | 237 ASSERT_TRUE(IsViewFocused(VIEW_ID_OMNIBOX)); |
238 } | 238 } |
239 | 239 |
240 // This test is only for Linux Desktop. | |
241 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) | |
242 #define MAYBE_BrowserDialogModalTest BrowserDialogModalTest | |
243 #else | |
244 #define MAYBE_BrowserDialogModalTest DISABLE_BrowserDialogModalTest | |
245 #endif | |
246 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_BrowserDialogModalTest) { | |
247 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | |
248 const GURL url = embedded_test_server()->GetURL(kSimplePage); | |
249 ui_test_utils::NavigateToURL(browser(), url); | |
250 | |
251 browser()->OpenFile(); | |
252 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); | |
sadrul
2015/08/20 06:24:20
Is this necessary here because you want to wait un
joone
2015/08/20 16:53:58
Ok, I will find another way of doing this.
| |
253 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync(gfx::Point(100, 100))); | |
254 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync( | |
255 ui_controls::LEFT, ui_controls::DOWN)); | |
sadrul
2015/08/20 06:24:20
You want to make sure the cursor is located within
joone
2015/08/20 16:53:58
Yes, right.
| |
256 // Create and show a test interstitial page. | |
257 // This page should not get focus due to modal dialog. | |
258 TestInterstitialPage* interstitial_page = new TestInterstitialPage( | |
259 browser()->tab_strip_model()->GetActiveWebContents()); | |
sadrul
2015/08/20 06:24:20
Why do you need to open the interstitial page here
joone
2015/08/20 16:53:58
The interstitial page could only lose focus when f
| |
260 EXPECT_FALSE(interstitial_page->HasFocus()); | |
261 } | |
262 | |
240 // Tabs remember focus. | 263 // Tabs remember focus. |
241 // Disabled, http://crbug.com/62542. | 264 // Disabled, http://crbug.com/62542. |
242 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_TabsRememberFocus) { | 265 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_TabsRememberFocus) { |
243 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 266 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
244 const GURL url = embedded_test_server()->GetURL(kSimplePage); | 267 const GURL url = embedded_test_server()->GetURL(kSimplePage); |
245 ui_test_utils::NavigateToURL(browser(), url); | 268 ui_test_utils::NavigateToURL(browser(), url); |
246 | 269 |
247 // Create several tabs. | 270 // Create several tabs. |
248 for (int i = 0; i < 4; ++i) { | 271 for (int i = 0; i < 4; ++i) { |
249 chrome::AddSelectedTabWithURL(browser(), url, | 272 chrome::AddSelectedTabWithURL(browser(), url, |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
701 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 724 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
702 content::NotificationService::AllSources()); | 725 content::NotificationService::AllSources()); |
703 chrome::GoForward(browser(), CURRENT_TAB); | 726 chrome::GoForward(browser(), CURRENT_TAB); |
704 forward_nav_observer.Wait(); | 727 forward_nav_observer.Wait(); |
705 } | 728 } |
706 | 729 |
707 EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX)); | 730 EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX)); |
708 } | 731 } |
709 | 732 |
710 } // namespace | 733 } // namespace |
OLD | NEW |