| 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/memory/weak_ptr.h" | 5 #include "base/memory/weak_ptr.h" |
| 6 #include "chrome/browser/platform_util.h" |
| 6 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 7 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/browser_commands.h" | 9 #include "chrome/browser/ui/browser_commands.h" |
| 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 10 #include "chrome/browser/ui/views/constrained_window_views.h" | 11 #include "chrome/browser/ui/views/constrained_window_views.h" |
| 11 #include "chrome/browser/ui/views/frame/browser_view.h" | 12 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 12 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" | 13 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" |
| 13 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" | 14 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" |
| 14 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
| 15 #include "chrome/test/base/in_process_browser_test.h" | 16 #include "chrome/test/base/in_process_browser_test.h" |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 330 |
| 330 GURL new_tab_url(chrome::kChromeUINewTabURL); | 331 GURL new_tab_url(chrome::kChromeUINewTabURL); |
| 331 ui_test_utils::NavigateToURL(browser(), new_tab_url); | 332 ui_test_utils::NavigateToURL(browser(), new_tab_url); |
| 332 ConstrainedWebDialogDelegate* cwdd = CreateConstrainedWebDialog( | 333 ConstrainedWebDialogDelegate* cwdd = CreateConstrainedWebDialog( |
| 333 browser()->profile(), | 334 browser()->profile(), |
| 334 new ui::test::TestWebDialogDelegate(new_tab_url), | 335 new ui::test::TestWebDialogDelegate(new_tab_url), |
| 335 NULL, | 336 NULL, |
| 336 web_contents); | 337 web_contents); |
| 337 | 338 |
| 338 ConstrainedWindowViews* cwv = | 339 ConstrainedWindowViews* cwv = |
| 339 static_cast<ConstrainedWindowViews*>(cwdd->GetWindow()); | 340 static_cast<ConstrainedWindowViews*>( |
| 341 views::Widget::GetWidgetForNativeView(cwdd->GetNativeDialog())); |
| 340 views::test::TestWidgetObserver observer(cwv); | 342 views::test::TestWidgetObserver observer(cwv); |
| 341 cwv->FocusWebContentsModalDialog(); | 343 cwv->FocusWebContentsModalDialog(); |
| 342 | 344 |
| 343 content::RenderViewHost* render_view_host = | 345 content::RenderViewHost* render_view_host = |
| 344 cwdd->GetWebContents()->GetRenderViewHost(); | 346 cwdd->GetWebContents()->GetRenderViewHost(); |
| 345 ForwardKeyEvent(render_view_host, ui::VKEY_ESCAPE); | 347 ForwardKeyEvent(render_view_host, ui::VKEY_ESCAPE); |
| 346 | 348 |
| 347 // Escape is not processed as accelerator before it's sent to web contents. | 349 // Escape is not processed as accelerator before it's sent to web contents. |
| 348 EXPECT_FALSE(observer.widget_closed()); | 350 EXPECT_FALSE(observer.widget_closed()); |
| 349 | 351 |
| 350 content::RunAllPendingInMessageLoop(); | 352 content::RunAllPendingInMessageLoop(); |
| 351 | 353 |
| 352 // Escape is processed as accelerator after it's sent to web contents. | 354 // Escape is processed as accelerator after it's sent to web contents. |
| 353 EXPECT_TRUE(observer.widget_closed()); | 355 EXPECT_TRUE(observer.widget_closed()); |
| 354 } | 356 } |
| 355 | 357 |
| 356 #endif // defined(OS_WIN) || (defined(USE_AURA) && defined(USE_X11)) | 358 #endif // defined(OS_WIN) || (defined(USE_AURA) && defined(USE_X11)) |
| OLD | NEW |