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/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/download/download_service.h" | 7 #include "chrome/browser/download/download_service.h" |
8 #include "chrome/browser/download/download_service_factory.h" | 8 #include "chrome/browser/download/download_service_factory.h" |
9 #include "chrome/browser/net/url_request_mock_util.h" | 9 #include "chrome/browser/net/url_request_mock_util.h" |
10 #include "chrome/browser/prefs/browser_prefs.h" | 10 #include "chrome/browser/prefs/browser_prefs.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/ui/panels/panel_manager.h" | 26 #include "chrome/browser/ui/panels/panel_manager.h" |
27 #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h" | 27 #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h" |
28 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 28 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
29 #include "chrome/browser/web_applications/web_app.h" | 29 #include "chrome/browser/web_applications/web_app.h" |
30 #include "chrome/common/chrome_notification_types.h" | 30 #include "chrome/common/chrome_notification_types.h" |
31 #include "chrome/common/extensions/extension_manifest_constants.h" | 31 #include "chrome/common/extensions/extension_manifest_constants.h" |
32 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
33 #include "chrome/common/url_constants.h" | 33 #include "chrome/common/url_constants.h" |
34 #include "chrome/test/base/ui_test_utils.h" | 34 #include "chrome/test/base/ui_test_utils.h" |
35 #include "content/public/browser/download_manager.h" | 35 #include "content/public/browser/download_manager.h" |
| 36 #include "content/public/browser/native_web_keyboard_event.h" |
36 #include "content/public/browser/notification_service.h" | 37 #include "content/public/browser/notification_service.h" |
37 #include "content/public/browser/web_contents.h" | 38 #include "content/public/browser/web_contents.h" |
38 #include "content/public/common/url_constants.h" | 39 #include "content/public/common/url_constants.h" |
39 #include "content/public/test/browser_test_utils.h" | 40 #include "content/public/test/browser_test_utils.h" |
40 #include "content/test/net/url_request_mock_http_job.h" | 41 #include "content/test/net/url_request_mock_http_job.h" |
41 #include "net/base/net_util.h" | 42 #include "net/base/net_util.h" |
42 #include "testing/gtest/include/gtest/gtest.h" | 43 #include "testing/gtest/include/gtest/gtest.h" |
43 #include "ui/gfx/screen.h" | 44 #include "ui/gfx/screen.h" |
44 | 45 |
45 // Refactor has only been done for Win and Mac panels so far. | 46 // Refactor has only been done for Win and Mac panels so far. |
(...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1571 EXPECT_EQ(smaller_work_area_size.height(), panel->max_size().height()); | 1572 EXPECT_EQ(smaller_work_area_size.height(), panel->max_size().height()); |
1572 EXPECT_GT(old_full_size.width(), panel->full_size().width()); | 1573 EXPECT_GT(old_full_size.width(), panel->full_size().width()); |
1573 EXPECT_GT(old_full_size.height(), panel->full_size().height()); | 1574 EXPECT_GT(old_full_size.height(), panel->full_size().height()); |
1574 EXPECT_GE(panel->max_size().width(), panel->full_size().width()); | 1575 EXPECT_GE(panel->max_size().width(), panel->full_size().width()); |
1575 EXPECT_GE(panel->max_size().height(), panel->full_size().height()); | 1576 EXPECT_GE(panel->max_size().height(), panel->full_size().height()); |
1576 EXPECT_EQ(smaller_work_area_size.height(), panel->full_size().height()); | 1577 EXPECT_EQ(smaller_work_area_size.height(), panel->full_size().height()); |
1577 | 1578 |
1578 panel->Close(); | 1579 panel->Close(); |
1579 } | 1580 } |
1580 | 1581 |
| 1582 #if defined(OS_WIN) |
| 1583 #define MAYBE_Accelerator Accelerator |
| 1584 #else |
| 1585 #define MAYBE_Accelerator DISABLED_Accelerator |
| 1586 #endif |
| 1587 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, Accelerator) { |
| 1588 PanelManager* panel_manager = PanelManager::GetInstance(); |
| 1589 |
| 1590 // Create a test panel with web contents loaded. |
| 1591 CreatePanelParams params("1", gfx::Rect(), SHOW_AS_ACTIVE); |
| 1592 GURL url(ui_test_utils::GetTestUrl( |
| 1593 FilePath(kTestDir), |
| 1594 FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); |
| 1595 params.url = url; |
| 1596 Panel* panel = CreatePanelWithParams(params); |
| 1597 EXPECT_EQ(1, panel_manager->num_panels()); |
| 1598 |
| 1599 // Close the panel by acclerator. |
| 1600 content::WindowedNotificationObserver signal( |
| 1601 chrome::NOTIFICATION_PANEL_CLOSED, |
| 1602 content::Source<Panel>(panel)); |
| 1603 #if defined(OS_WIN) |
| 1604 ::MSG key_msg = { NULL, WM_KEYDOWN, ui::VKEY_W, 0 }; |
| 1605 content::NativeWebKeyboardEvent key_event(key_msg); |
| 1606 key_event.modifiers = content::NativeWebKeyboardEvent::ControlKey; |
| 1607 #else |
| 1608 content::NativeWebKeyboardEvent key_event; |
| 1609 #endif |
| 1610 panel->HandleKeyboardEvent(key_event); |
| 1611 signal.Wait(); |
| 1612 EXPECT_EQ(0, panel_manager->num_panels()); |
| 1613 } |
| 1614 |
1581 #endif // OS_WIN || OS_MACOSX | 1615 #endif // OS_WIN || OS_MACOSX |
OLD | NEW |