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 14 matching lines...) Expand all Loading... |
25 #include "chrome/browser/ui/panels/panel.h" | 25 #include "chrome/browser/ui/panels/panel.h" |
26 #include "chrome/browser/ui/panels/panel_manager.h" | 26 #include "chrome/browser/ui/panels/panel_manager.h" |
27 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 27 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
28 #include "chrome/browser/web_applications/web_app.h" | 28 #include "chrome/browser/web_applications/web_app.h" |
29 #include "chrome/common/chrome_notification_types.h" | 29 #include "chrome/common/chrome_notification_types.h" |
30 #include "chrome/common/extensions/extension_manifest_constants.h" | 30 #include "chrome/common/extensions/extension_manifest_constants.h" |
31 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
32 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
33 #include "chrome/test/base/ui_test_utils.h" | 33 #include "chrome/test/base/ui_test_utils.h" |
34 #include "content/public/browser/download_manager.h" | 34 #include "content/public/browser/download_manager.h" |
| 35 #include "content/public/browser/native_web_keyboard_event.h" |
35 #include "content/public/browser/notification_service.h" | 36 #include "content/public/browser/notification_service.h" |
36 #include "content/public/browser/web_contents.h" | 37 #include "content/public/browser/web_contents.h" |
37 #include "content/public/common/url_constants.h" | 38 #include "content/public/common/url_constants.h" |
38 #include "content/public/test/browser_test_utils.h" | 39 #include "content/public/test/browser_test_utils.h" |
39 #include "content/test/net/url_request_mock_http_job.h" | 40 #include "content/test/net/url_request_mock_http_job.h" |
40 #include "net/base/net_util.h" | 41 #include "net/base/net_util.h" |
41 #include "testing/gtest/include/gtest/gtest.h" | 42 #include "testing/gtest/include/gtest/gtest.h" |
42 #include "ui/gfx/screen.h" | 43 #include "ui/gfx/screen.h" |
43 | 44 |
44 // Refactor has only been done for Win and Mac panels so far. | 45 // Refactor has only been done for Win and Mac panels so far. |
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 EXPECT_EQ(smaller_work_area_size.height(), panel->max_size().height()); | 1539 EXPECT_EQ(smaller_work_area_size.height(), panel->max_size().height()); |
1539 EXPECT_GT(old_full_size.width(), panel->full_size().width()); | 1540 EXPECT_GT(old_full_size.width(), panel->full_size().width()); |
1540 EXPECT_GT(old_full_size.height(), panel->full_size().height()); | 1541 EXPECT_GT(old_full_size.height(), panel->full_size().height()); |
1541 EXPECT_GE(panel->max_size().width(), panel->full_size().width()); | 1542 EXPECT_GE(panel->max_size().width(), panel->full_size().width()); |
1542 EXPECT_GE(panel->max_size().height(), panel->full_size().height()); | 1543 EXPECT_GE(panel->max_size().height(), panel->full_size().height()); |
1543 EXPECT_EQ(smaller_work_area_size.height(), panel->full_size().height()); | 1544 EXPECT_EQ(smaller_work_area_size.height(), panel->full_size().height()); |
1544 | 1545 |
1545 panel->Close(); | 1546 panel->Close(); |
1546 } | 1547 } |
1547 | 1548 |
| 1549 #if defined(OS_WIN) |
| 1550 #define MAYBE_Accelerator Accelerator |
| 1551 #else |
| 1552 #define MAYBE_Accelerator DISABLED_Accelerator |
| 1553 #endif |
| 1554 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, MAYBE_Accelerator) { |
| 1555 PanelManager* panel_manager = PanelManager::GetInstance(); |
| 1556 |
| 1557 // Create a test panel with web contents loaded. |
| 1558 CreatePanelParams params("1", gfx::Rect(), SHOW_AS_ACTIVE); |
| 1559 GURL url(ui_test_utils::GetTestUrl( |
| 1560 FilePath(kTestDir), |
| 1561 FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); |
| 1562 params.url = url; |
| 1563 Panel* panel = CreatePanelWithParams(params); |
| 1564 EXPECT_EQ(1, panel_manager->num_panels()); |
| 1565 |
| 1566 // Close the panel by acclerator. |
| 1567 content::WindowedNotificationObserver signal( |
| 1568 chrome::NOTIFICATION_PANEL_CLOSED, |
| 1569 content::Source<Panel>(panel)); |
| 1570 #if defined(USE_AURA) |
| 1571 content::NativeWebKeyboardEvent key_event( |
| 1572 ui::ET_KEY_PRESSED, |
| 1573 false, |
| 1574 ui::VKEY_W, |
| 1575 ui::EF_CONTROL_DOWN, |
| 1576 base::Time::Now().ToDoubleT()); |
| 1577 #elif defined(OS_WIN) |
| 1578 ::MSG key_msg = { NULL, WM_KEYDOWN, ui::VKEY_W, 0 }; |
| 1579 content::NativeWebKeyboardEvent key_event(key_msg); |
| 1580 key_event.modifiers = content::NativeWebKeyboardEvent::ControlKey; |
| 1581 #else |
| 1582 content::NativeWebKeyboardEvent key_event; |
| 1583 #endif |
| 1584 panel->HandleKeyboardEvent(key_event); |
| 1585 signal.Wait(); |
| 1586 EXPECT_EQ(0, panel_manager->num_panels()); |
| 1587 } |
| 1588 |
1548 #endif // OS_WIN || OS_MACOSX | 1589 #endif // OS_WIN || OS_MACOSX |
OLD | NEW |