OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "chrome/browser/automation/ui_controls.h" | 6 #include "chrome/browser/automation/ui_controls.h" |
7 #include "chrome/browser/browser.h" | 7 #include "chrome/browser/browser.h" |
8 #include "chrome/browser/dom_operation_notification_details.h" | 8 #include "chrome/browser/dom_operation_notification_details.h" |
9 #include "chrome/browser/tab_contents/web_contents.h" | 9 #include "chrome/browser/tab_contents/web_contents.h" |
10 #include "chrome/browser/view_ids.h" | 10 #include "chrome/browser/view_ids.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 // Activate the first browser. | 238 // Activate the first browser. |
239 browser()->window()->Activate(); | 239 browser()->window()->Activate(); |
240 | 240 |
241 // Wait for the focus to be stolen by the other browser. | 241 // Wait for the focus to be stolen by the other browser. |
242 ::Sleep(2000); | 242 ::Sleep(2000); |
243 | 243 |
244 // Make sure the first browser is still active. | 244 // Make sure the first browser is still active. |
245 HWND hwnd = reinterpret_cast<HWND>(browser()->window()->GetNativeHandle()); | 245 HWND hwnd = reinterpret_cast<HWND>(browser()->window()->GetNativeHandle()); |
246 BrowserView* browser_view = BrowserView::GetBrowserViewForHWND(hwnd); | 246 BrowserView* browser_view = BrowserView::GetBrowserViewForHWND(hwnd); |
247 ASSERT_TRUE(browser_view); | 247 ASSERT_TRUE(browser_view); |
248 EXPECT_TRUE(browser_view->frame()->GetWindow()->IsActive()); | 248 EXPECT_TRUE(browser_view->frame()->IsActive()); |
249 | 249 |
250 // Close the 2nd browser to avoid a DCHECK(). | 250 // Close the 2nd browser to avoid a DCHECK(). |
251 HWND hwnd2 = reinterpret_cast<HWND>(browser2->window()->GetNativeHandle()); | 251 HWND hwnd2 = reinterpret_cast<HWND>(browser2->window()->GetNativeHandle()); |
252 BrowserView* browser_view2 = BrowserView::GetBrowserViewForHWND(hwnd2); | 252 BrowserView* browser_view2 = BrowserView::GetBrowserViewForHWND(hwnd2); |
253 browser_view2->Close(); | 253 browser_view2->Close(); |
254 } | 254 } |
255 | 255 |
256 // Page cannot steal focus when focus is on location bar. | 256 // Page cannot steal focus when focus is on location bar. |
257 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, LocationBarLockFocus) { | 257 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, LocationBarLockFocus) { |
258 HTTPTestServer* server = StartHTTPServer(); | 258 HTTPTestServer* server = StartHTTPServer(); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 | 435 |
436 // See remark above on why we wait. | 436 // See remark above on why we wait. |
437 ::Sleep(kActionDelayMs); | 437 ::Sleep(kActionDelayMs); |
438 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); | 438 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); |
439 ui_test_utils::RunMessageLoop(); | 439 ui_test_utils::RunMessageLoop(); |
440 | 440 |
441 focused_view = focus_manager->GetFocusedView(); | 441 focused_view = focus_manager->GetFocusedView(); |
442 ASSERT_TRUE(focused_view != NULL); | 442 ASSERT_TRUE(focused_view != NULL); |
443 EXPECT_EQ(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD, focused_view->GetID()); | 443 EXPECT_EQ(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD, focused_view->GetID()); |
444 } | 444 } |
OLD | NEW |