Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Side by Side Diff: chrome/browser/ui/panels/panel_browsertest.cc

Issue 10831226: Panels refactor: Support browserless panels on Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove static initializer Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "chrome/browser/prefs/pref_service.h" 11 #include "chrome/browser/prefs/pref_service.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" 13 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h"
14 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" 14 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"
15 #include "chrome/browser/ui/browser_commands.h" 15 #include "chrome/browser/ui/browser_commands.h"
16 #include "chrome/browser/ui/browser_finder.h" 16 #include "chrome/browser/ui/browser_finder.h"
17 #include "chrome/browser/ui/browser_list.h" 17 #include "chrome/browser/ui/browser_list.h"
18 #include "chrome/browser/ui/browser_tabstrip.h" 18 #include "chrome/browser/ui/browser_tabstrip.h"
19 #include "chrome/browser/ui/browser_window.h" 19 #include "chrome/browser/ui/browser_window.h"
20 #include "chrome/browser/ui/find_bar/find_bar.h" 20 #include "chrome/browser/ui/find_bar/find_bar.h"
21 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 21 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
22 #include "chrome/browser/ui/panels/base_panel_browser_test.h" 22 #include "chrome/browser/ui/panels/base_panel_browser_test.h"
23 #include "chrome/browser/ui/panels/docked_panel_strip.h" 23 #include "chrome/browser/ui/panels/docked_panel_strip.h"
24 #include "chrome/browser/ui/panels/native_panel.h" 24 #include "chrome/browser/ui/panels/native_panel.h"
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/panels/test_panel_active_state_observer.h"
27 #include "chrome/browser/ui/tabs/tab_strip_model.h" 28 #include "chrome/browser/ui/tabs/tab_strip_model.h"
28 #include "chrome/browser/web_applications/web_app.h" 29 #include "chrome/browser/web_applications/web_app.h"
29 #include "chrome/common/chrome_notification_types.h" 30 #include "chrome/common/chrome_notification_types.h"
30 #include "chrome/common/extensions/extension_manifest_constants.h" 31 #include "chrome/common/extensions/extension_manifest_constants.h"
31 #include "chrome/common/pref_names.h" 32 #include "chrome/common/pref_names.h"
32 #include "chrome/common/url_constants.h" 33 #include "chrome/common/url_constants.h"
33 #include "chrome/test/base/ui_test_utils.h" 34 #include "chrome/test/base/ui_test_utils.h"
34 #include "content/public/browser/download_manager.h" 35 #include "content/public/browser/download_manager.h"
35 #include "content/public/browser/native_web_keyboard_event.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 #if defined(OS_WIN) || defined(OS_MACOSX)
47
48 using content::BrowserContext; 46 using content::BrowserContext;
49 using content::BrowserThread; 47 using content::BrowserThread;
50 using content::DownloadItem; 48 using content::DownloadItem;
51 using content::DownloadManager; 49 using content::DownloadManager;
52 using content::WebContents; 50 using content::WebContents;
53 using extensions::Extension; 51 using extensions::Extension;
54 52
55 class PanelBrowserTest : public BasePanelBrowserTest { 53 class PanelBrowserTest : public BasePanelBrowserTest {
56 public: 54 public:
57 PanelBrowserTest() : BasePanelBrowserTest() { 55 PanelBrowserTest() : BasePanelBrowserTest() {
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 WaitForExpansionStateChanged(panel, Panel::MINIMIZED); 1259 WaitForExpansionStateChanged(panel, Panel::MINIMIZED);
1262 1260
1263 panel->Close(); 1261 panel->Close();
1264 } 1262 }
1265 1263
1266 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, FocusLostOnMinimize) { 1264 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, FocusLostOnMinimize) {
1267 CreatePanelParams params("Initially Active", gfx::Rect(), SHOW_AS_ACTIVE); 1265 CreatePanelParams params("Initially Active", gfx::Rect(), SHOW_AS_ACTIVE);
1268 Panel* panel = CreatePanelWithParams(params); 1266 Panel* panel = CreatePanelWithParams(params);
1269 EXPECT_EQ(Panel::EXPANDED, panel->expansion_state()); 1267 EXPECT_EQ(Panel::EXPANDED, panel->expansion_state());
1270 1268
1271 panel->SetExpansionState(Panel::MINIMIZED); 1269 PanelActiveStateObserver signal(panel, false);
1272 MessageLoop::current()->RunAllPending(); 1270 panel->Minimize();
1273 WaitForPanelActiveState(panel, SHOW_AS_INACTIVE); 1271 signal.Wait();
1274 panel->Close(); 1272 panel->Close();
1275 } 1273 }
1276 1274
1277 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, CreateInactiveSwitchToActive) { 1275 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, CreateInactiveSwitchToActive) {
1278 // Compiz will not activate initially inactive window. 1276 // Compiz will not activate initially inactive window.
1279 if (SkipTestIfCompizWM()) 1277 if (SkipTestIfCompizWM())
1280 return; 1278 return;
1281 1279
1282 CreatePanelParams params("Initially Inactive", gfx::Rect(), SHOW_AS_INACTIVE); 1280 CreatePanelParams params("Initially Inactive", gfx::Rect(), SHOW_AS_INACTIVE);
1283 Panel* panel = CreatePanelWithParams(params); 1281 Panel* panel = CreatePanelWithParams(params);
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 content::NativeWebKeyboardEvent key_event(key_msg); 1577 content::NativeWebKeyboardEvent key_event(key_msg);
1580 key_event.modifiers = content::NativeWebKeyboardEvent::ControlKey; 1578 key_event.modifiers = content::NativeWebKeyboardEvent::ControlKey;
1581 #else 1579 #else
1582 content::NativeWebKeyboardEvent key_event; 1580 content::NativeWebKeyboardEvent key_event;
1583 #endif 1581 #endif
1584 panel->HandleKeyboardEvent(key_event); 1582 panel->HandleKeyboardEvent(key_event);
1585 signal.Wait(); 1583 signal.Wait();
1586 EXPECT_EQ(0, panel_manager->num_panels()); 1584 EXPECT_EQ(0, panel_manager->num_panels());
1587 } 1585 }
1588 1586
1589 #endif // OS_WIN || OS_MACOSX
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698