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

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: feedback changes 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"
(...skipping 24 matching lines...) Expand all
35 #include "content/public/browser/download_manager.h" 35 #include "content/public/browser/download_manager.h"
36 #include "content/public/browser/notification_service.h" 36 #include "content/public/browser/notification_service.h"
37 #include "content/public/browser/web_contents.h" 37 #include "content/public/browser/web_contents.h"
38 #include "content/public/common/url_constants.h" 38 #include "content/public/common/url_constants.h"
39 #include "content/public/test/browser_test_utils.h" 39 #include "content/public/test/browser_test_utils.h"
40 #include "content/test/net/url_request_mock_http_job.h" 40 #include "content/test/net/url_request_mock_http_job.h"
41 #include "net/base/net_util.h" 41 #include "net/base/net_util.h"
42 #include "testing/gtest/include/gtest/gtest.h" 42 #include "testing/gtest/include/gtest/gtest.h"
43 #include "ui/gfx/screen.h" 43 #include "ui/gfx/screen.h"
44 44
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; 45 using content::BrowserContext;
49 using content::BrowserThread; 46 using content::BrowserThread;
50 using content::DownloadItem; 47 using content::DownloadItem;
51 using content::DownloadManager; 48 using content::DownloadManager;
52 using content::WebContents; 49 using content::WebContents;
53 using extensions::Extension; 50 using extensions::Extension;
54 51
55 class PanelBrowserTest : public BasePanelBrowserTest { 52 class PanelBrowserTest : public BasePanelBrowserTest {
56 public: 53 public:
57 PanelBrowserTest() : BasePanelBrowserTest() { 54 PanelBrowserTest() : BasePanelBrowserTest() {
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 WaitForExpansionStateChanged(panel, Panel::MINIMIZED); 1290 WaitForExpansionStateChanged(panel, Panel::MINIMIZED);
1294 1291
1295 panel->Close(); 1292 panel->Close();
1296 } 1293 }
1297 1294
1298 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, FocusLostOnMinimize) { 1295 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, FocusLostOnMinimize) {
1299 CreatePanelParams params("Initially Active", gfx::Rect(), SHOW_AS_ACTIVE); 1296 CreatePanelParams params("Initially Active", gfx::Rect(), SHOW_AS_ACTIVE);
1300 Panel* panel = CreatePanelWithParams(params); 1297 Panel* panel = CreatePanelWithParams(params);
1301 EXPECT_EQ(Panel::EXPANDED, panel->expansion_state()); 1298 EXPECT_EQ(Panel::EXPANDED, panel->expansion_state());
1302 1299
1303 panel->SetExpansionState(Panel::MINIMIZED); 1300 PanelActiveStateObserver signal(panel, false);
1304 MessageLoop::current()->RunAllPending(); 1301 panel->Minimize();
1305 WaitForPanelActiveState(panel, SHOW_AS_INACTIVE); 1302 signal.Wait();
1306 panel->Close(); 1303 panel->Close();
1307 } 1304 }
1308 1305
1309 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, CreateInactiveSwitchToActive) { 1306 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, CreateInactiveSwitchToActive) {
1310 // Compiz will not activate initially inactive window. 1307 // Compiz will not activate initially inactive window.
1311 if (SkipTestIfCompizWM()) 1308 if (SkipTestIfCompizWM())
1312 return; 1309 return;
1313 1310
1314 CreatePanelParams params("Initially Inactive", gfx::Rect(), SHOW_AS_INACTIVE); 1311 CreatePanelParams params("Initially Inactive", gfx::Rect(), SHOW_AS_INACTIVE);
1315 Panel* panel = CreatePanelWithParams(params); 1312 Panel* panel = CreatePanelWithParams(params);
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 EXPECT_GE(smaller_work_area_size.width(), panel->max_size().width()); 1567 EXPECT_GE(smaller_work_area_size.width(), panel->max_size().width());
1571 EXPECT_EQ(smaller_work_area_size.height(), panel->max_size().height()); 1568 EXPECT_EQ(smaller_work_area_size.height(), panel->max_size().height());
1572 EXPECT_GT(old_full_size.width(), panel->full_size().width()); 1569 EXPECT_GT(old_full_size.width(), panel->full_size().width());
1573 EXPECT_GT(old_full_size.height(), panel->full_size().height()); 1570 EXPECT_GT(old_full_size.height(), panel->full_size().height());
1574 EXPECT_GE(panel->max_size().width(), panel->full_size().width()); 1571 EXPECT_GE(panel->max_size().width(), panel->full_size().width());
1575 EXPECT_GE(panel->max_size().height(), panel->full_size().height()); 1572 EXPECT_GE(panel->max_size().height(), panel->full_size().height());
1576 EXPECT_EQ(smaller_work_area_size.height(), panel->full_size().height()); 1573 EXPECT_EQ(smaller_work_area_size.height(), panel->full_size().height());
1577 1574
1578 panel->Close(); 1575 panel->Close();
1579 } 1576 }
1580
1581 #endif // OS_WIN || OS_MACOSX
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698