Chromium Code Reviews| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <set> | 6 #include <set> |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1276 // Verify origin is stable for a frameless window as well. | 1276 // Verify origin is stable for a frameless window as well. |
| 1277 widget->SetSize(kTestSize); | 1277 widget->SetSize(kTestSize); |
| 1278 EXPECT_EQ(kTestBounds.origin().ToString(), | 1278 EXPECT_EQ(kTestBounds.origin().ToString(), |
| 1279 widget->GetWindowBoundsInScreen().origin().ToString()); | 1279 widget->GetWindowBoundsInScreen().origin().ToString()); |
| 1280 | 1280 |
| 1281 widget->CloseNow(); | 1281 widget->CloseNow(); |
| 1282 } | 1282 } |
| 1283 | 1283 |
| 1284 // Before being enabled on Mac, this was #ifdef(false). | 1284 // Before being enabled on Mac, this was #ifdef(false). |
| 1285 // TODO(tapted): Fix this for DesktopNativeWidgets on other platforms. | 1285 // TODO(tapted): Fix this for DesktopNativeWidgets on other platforms. |
| 1286 #if defined(OS_MACOSX) | 1286 #if defined(OS_MACOSX) |
|
tapted
2015/07/30 03:04:35
I wonder.... should we try
#if !defined(OS_CHROME
jackhou1
2015/07/30 06:18:13
Done. But then disabled on Linux because it doesn'
| |
| 1287 // Aura needs shell to maximize/fullscreen window. | 1287 // Aura needs shell to maximize/fullscreen window. |
| 1288 // NativeWidgetGtk doesn't implement GetRestoredBounds. | 1288 // NativeWidgetGtk doesn't implement GetRestoredBounds. |
| 1289 TEST_F(WidgetTest, GetRestoredBounds) { | 1289 TEST_F(WidgetTest, GetRestoredBounds) { |
| 1290 Widget* toplevel = CreateTopLevelPlatformWidget(); | 1290 Widget* toplevel = CreateTopLevelPlatformWidget(); |
| 1291 EXPECT_EQ(toplevel->GetWindowBoundsInScreen().ToString(), | 1291 EXPECT_EQ(toplevel->GetWindowBoundsInScreen().ToString(), |
| 1292 toplevel->GetRestoredBounds().ToString()); | 1292 toplevel->GetRestoredBounds().ToString()); |
| 1293 toplevel->Show(); | 1293 toplevel->Show(); |
| 1294 toplevel->Maximize(); | 1294 toplevel->Maximize(); |
| 1295 RunPendingMessages(); | 1295 RunPendingMessages(); |
| 1296 #if defined(OS_MACOSX) | 1296 #if defined(OS_MACOSX) |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1315 if (IsTestingSnowLeopard()) { | 1315 if (IsTestingSnowLeopard()) { |
| 1316 // Fullscreen not implemented for Snow Leopard. | 1316 // Fullscreen not implemented for Snow Leopard. |
| 1317 EXPECT_EQ(toplevel->GetWindowBoundsInScreen().ToString(), | 1317 EXPECT_EQ(toplevel->GetWindowBoundsInScreen().ToString(), |
| 1318 toplevel->GetRestoredBounds().ToString()); | 1318 toplevel->GetRestoredBounds().ToString()); |
| 1319 } else { | 1319 } else { |
| 1320 EXPECT_NE(toplevel->GetWindowBoundsInScreen().ToString(), | 1320 EXPECT_NE(toplevel->GetWindowBoundsInScreen().ToString(), |
| 1321 toplevel->GetRestoredBounds().ToString()); | 1321 toplevel->GetRestoredBounds().ToString()); |
| 1322 } | 1322 } |
| 1323 EXPECT_GT(toplevel->GetRestoredBounds().width(), 0); | 1323 EXPECT_GT(toplevel->GetRestoredBounds().width(), 0); |
| 1324 EXPECT_GT(toplevel->GetRestoredBounds().height(), 0); | 1324 EXPECT_GT(toplevel->GetRestoredBounds().height(), 0); |
| 1325 | |
| 1326 toplevel->CloseNow(); | |
| 1325 } | 1327 } |
| 1326 #endif | 1328 #endif |
| 1327 | 1329 |
| 1328 // The key-event propagation from Widget happens differently on aura and | 1330 // The key-event propagation from Widget happens differently on aura and |
| 1329 // non-aura systems because of the difference in IME. So this test works only on | 1331 // non-aura systems because of the difference in IME. So this test works only on |
| 1330 // aura. | 1332 // aura. |
| 1331 TEST_F(WidgetTest, KeyboardInputEvent) { | 1333 TEST_F(WidgetTest, KeyboardInputEvent) { |
| 1332 Widget* toplevel = CreateTopLevelPlatformWidget(); | 1334 Widget* toplevel = CreateTopLevelPlatformWidget(); |
| 1333 View* container = toplevel->client_view(); | 1335 View* container = toplevel->client_view(); |
| 1334 | 1336 |
| (...skipping 2103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3438 EXPECT_FALSE(widget->IsAlwaysOnTop()); | 3440 EXPECT_FALSE(widget->IsAlwaysOnTop()); |
| 3439 widget->SetAlwaysOnTop(true); | 3441 widget->SetAlwaysOnTop(true); |
| 3440 EXPECT_TRUE(widget->IsAlwaysOnTop()); | 3442 EXPECT_TRUE(widget->IsAlwaysOnTop()); |
| 3441 widget->SetAlwaysOnTop(false); | 3443 widget->SetAlwaysOnTop(false); |
| 3442 EXPECT_FALSE(widget->IsAlwaysOnTop()); | 3444 EXPECT_FALSE(widget->IsAlwaysOnTop()); |
| 3443 widget->CloseNow(); | 3445 widget->CloseNow(); |
| 3444 } | 3446 } |
| 3445 | 3447 |
| 3446 } // namespace test | 3448 } // namespace test |
| 3447 } // namespace views | 3449 } // namespace views |
| OLD | NEW |