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" | |
37 #include "content/public/browser/notification_service.h" | 36 #include "content/public/browser/notification_service.h" |
38 #include "content/public/browser/web_contents.h" | 37 #include "content/public/browser/web_contents.h" |
39 #include "content/public/common/url_constants.h" | 38 #include "content/public/common/url_constants.h" |
40 #include "content/public/test/browser_test_utils.h" | 39 #include "content/public/test/browser_test_utils.h" |
41 #include "content/test/net/url_request_mock_http_job.h" | 40 #include "content/test/net/url_request_mock_http_job.h" |
42 #include "net/base/net_util.h" | 41 #include "net/base/net_util.h" |
43 #include "testing/gtest/include/gtest/gtest.h" | 42 #include "testing/gtest/include/gtest/gtest.h" |
44 #include "ui/gfx/screen.h" | 43 #include "ui/gfx/screen.h" |
45 | 44 |
46 // 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 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1573 EXPECT_EQ(smaller_work_area_size.height(), panel->max_size().height()); | 1572 EXPECT_EQ(smaller_work_area_size.height(), panel->max_size().height()); |
1574 EXPECT_GT(old_full_size.width(), panel->full_size().width()); | 1573 EXPECT_GT(old_full_size.width(), panel->full_size().width()); |
1575 EXPECT_GT(old_full_size.height(), panel->full_size().height()); | 1574 EXPECT_GT(old_full_size.height(), panel->full_size().height()); |
1576 EXPECT_GE(panel->max_size().width(), panel->full_size().width()); | 1575 EXPECT_GE(panel->max_size().width(), panel->full_size().width()); |
1577 EXPECT_GE(panel->max_size().height(), panel->full_size().height()); | 1576 EXPECT_GE(panel->max_size().height(), panel->full_size().height()); |
1578 EXPECT_EQ(smaller_work_area_size.height(), panel->full_size().height()); | 1577 EXPECT_EQ(smaller_work_area_size.height(), panel->full_size().height()); |
1579 | 1578 |
1580 panel->Close(); | 1579 panel->Close(); |
1581 } | 1580 } |
1582 | 1581 |
1583 #if defined(OS_WIN) | |
1584 #define MAYBE_Accelerator Accelerator | |
1585 #else | |
1586 #define MAYBE_Accelerator DISABLED_Accelerator | |
1587 #endif | |
1588 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, MAYBE_Accelerator) { | |
1589 PanelManager* panel_manager = PanelManager::GetInstance(); | |
1590 | |
1591 // Create a test panel with web contents loaded. | |
1592 CreatePanelParams params("1", gfx::Rect(), SHOW_AS_ACTIVE); | |
1593 GURL url(ui_test_utils::GetTestUrl( | |
1594 FilePath(kTestDir), | |
1595 FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); | |
1596 params.url = url; | |
1597 Panel* panel = CreatePanelWithParams(params); | |
1598 EXPECT_EQ(1, panel_manager->num_panels()); | |
1599 | |
1600 // Close the panel by acclerator. | |
1601 content::WindowedNotificationObserver signal( | |
1602 chrome::NOTIFICATION_PANEL_CLOSED, | |
1603 content::Source<Panel>(panel)); | |
1604 #if defined(OS_WIN) | |
1605 ::MSG key_msg = { NULL, WM_KEYDOWN, ui::VKEY_W, 0 }; | |
1606 content::NativeWebKeyboardEvent key_event(key_msg); | |
1607 key_event.modifiers = content::NativeWebKeyboardEvent::ControlKey; | |
1608 #else | |
1609 content::NativeWebKeyboardEvent key_event; | |
1610 #endif | |
1611 panel->HandleKeyboardEvent(key_event); | |
1612 signal.Wait(); | |
1613 EXPECT_EQ(0, panel_manager->num_panels()); | |
1614 } | |
1615 | |
1616 #endif // OS_WIN || OS_MACOSX | 1582 #endif // OS_WIN || OS_MACOSX |
OLD | NEW |