| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/i18n/time_formatting.h" | 5 #include "base/i18n/time_formatting.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
| 10 #include "chrome/browser/ui/panels/base_panel_browser_test.h" | 10 #include "chrome/browser/ui/panels/base_panel_browser_test.h" |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 }; | 417 }; |
| 418 | 418 |
| 419 // Panel is not supported for Linux view yet. | 419 // Panel is not supported for Linux view yet. |
| 420 #if !defined(OS_LINUX) || !defined(TOOLKIT_VIEWS) | 420 #if !defined(OS_LINUX) || !defined(TOOLKIT_VIEWS) |
| 421 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, CreatePanelBasic) { | 421 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, CreatePanelBasic) { |
| 422 CreatePanelParams params( | 422 CreatePanelParams params( |
| 423 "PanelTest", gfx::Rect(0, 0, 200, 150), SHOW_AS_ACTIVE); | 423 "PanelTest", gfx::Rect(0, 0, 200, 150), SHOW_AS_ACTIVE); |
| 424 Panel* panel = CreatePanelWithParams(params); | 424 Panel* panel = CreatePanelWithParams(params); |
| 425 | 425 |
| 426 // Validate basic window properties. | 426 // Validate basic window properties. |
| 427 #if defined(OS_WIN) | 427 #if defined(OS_WIN) && !defined(USE_AURA) |
| 428 HWND native_window = GetNativeWindow(panel); | 428 HWND native_window = GetNativeWindow(panel); |
| 429 | 429 |
| 430 RECT window_rect; | 430 RECT window_rect; |
| 431 EXPECT_TRUE(::GetWindowRect(native_window, &window_rect)); | 431 EXPECT_TRUE(::GetWindowRect(native_window, &window_rect)); |
| 432 EXPECT_EQ(200, window_rect.right - window_rect.left); | 432 EXPECT_EQ(200, window_rect.right - window_rect.left); |
| 433 EXPECT_EQ(150, window_rect.bottom - window_rect.top); | 433 EXPECT_EQ(150, window_rect.bottom - window_rect.top); |
| 434 | 434 |
| 435 EXPECT_TRUE(::IsWindowVisible(native_window)); | 435 EXPECT_TRUE(::IsWindowVisible(native_window)); |
| 436 #endif | 436 #endif |
| 437 | 437 |
| 438 panel->Close(); | 438 panel->Close(); |
| 439 } | 439 } |
| 440 | 440 |
| 441 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, CreatePanelActive) { | 441 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, CreatePanelActive) { |
| 442 CreatePanelParams params("PanelTest", gfx::Rect(), SHOW_AS_ACTIVE); | 442 CreatePanelParams params("PanelTest", gfx::Rect(), SHOW_AS_ACTIVE); |
| 443 Panel* panel = CreatePanelWithParams(params); | 443 Panel* panel = CreatePanelWithParams(params); |
| 444 | 444 |
| 445 // Validate it is active. | 445 // Validate it is active. |
| 446 EXPECT_TRUE(panel->IsActive()); | 446 EXPECT_TRUE(panel->IsActive()); |
| 447 EXPECT_TRUE(IsTitlebarPaintedAsActive(panel)); | 447 EXPECT_TRUE(IsTitlebarPaintedAsActive(panel)); |
| 448 | 448 |
| 449 // Validate window styles. We want to ensure that the window is created | 449 // Validate window styles. We want to ensure that the window is created |
| 450 // with expected styles regardless of its active state. | 450 // with expected styles regardless of its active state. |
| 451 #if defined(OS_WIN) | 451 #if defined(OS_WIN) && !defined(USE_AURA) |
| 452 HWND native_window = GetNativeWindow(panel); | 452 HWND native_window = GetNativeWindow(panel); |
| 453 | 453 |
| 454 LONG styles = ::GetWindowLong(native_window, GWL_STYLE); | 454 LONG styles = ::GetWindowLong(native_window, GWL_STYLE); |
| 455 EXPECT_EQ(0, styles & WS_MAXIMIZEBOX); | 455 EXPECT_EQ(0, styles & WS_MAXIMIZEBOX); |
| 456 EXPECT_EQ(0, styles & WS_MINIMIZEBOX); | 456 EXPECT_EQ(0, styles & WS_MINIMIZEBOX); |
| 457 EXPECT_EQ(0, styles & WS_THICKFRAME); | 457 EXPECT_EQ(0, styles & WS_THICKFRAME); |
| 458 | 458 |
| 459 LONG ext_styles = ::GetWindowLong(native_window, GWL_EXSTYLE); | 459 LONG ext_styles = ::GetWindowLong(native_window, GWL_EXSTYLE); |
| 460 EXPECT_EQ(WS_EX_TOPMOST, ext_styles & WS_EX_TOPMOST); | 460 EXPECT_EQ(WS_EX_TOPMOST, ext_styles & WS_EX_TOPMOST); |
| 461 #endif | 461 #endif |
| 462 | 462 |
| 463 panel->Close(); | 463 panel->Close(); |
| 464 } | 464 } |
| 465 | 465 |
| 466 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, CreatePanelInactive) { | 466 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, CreatePanelInactive) { |
| 467 CreatePanelParams params("PanelTest", gfx::Rect(), SHOW_AS_INACTIVE); | 467 CreatePanelParams params("PanelTest", gfx::Rect(), SHOW_AS_INACTIVE); |
| 468 Panel* panel = CreatePanelWithParams(params); | 468 Panel* panel = CreatePanelWithParams(params); |
| 469 | 469 |
| 470 // Validate it is inactive. | 470 // Validate it is inactive. |
| 471 EXPECT_FALSE(panel->IsActive()); | 471 EXPECT_FALSE(panel->IsActive()); |
| 472 EXPECT_FALSE(IsTitlebarPaintedAsActive(panel)); | 472 EXPECT_FALSE(IsTitlebarPaintedAsActive(panel)); |
| 473 | 473 |
| 474 // Validate window styles. We want to ensure that the window is created | 474 // Validate window styles. We want to ensure that the window is created |
| 475 // with expected styles regardless of its active state. | 475 // with expected styles regardless of its active state. |
| 476 #if defined(OS_WIN) | 476 #if defined(OS_WIN) && !defined(USE_AURA) |
| 477 HWND native_window = GetNativeWindow(panel); | 477 HWND native_window = GetNativeWindow(panel); |
| 478 | 478 |
| 479 LONG styles = ::GetWindowLong(native_window, GWL_STYLE); | 479 LONG styles = ::GetWindowLong(native_window, GWL_STYLE); |
| 480 EXPECT_EQ(0, styles & WS_MAXIMIZEBOX); | 480 EXPECT_EQ(0, styles & WS_MAXIMIZEBOX); |
| 481 EXPECT_EQ(0, styles & WS_MINIMIZEBOX); | 481 EXPECT_EQ(0, styles & WS_MINIMIZEBOX); |
| 482 EXPECT_EQ(0, styles & WS_THICKFRAME); | 482 EXPECT_EQ(0, styles & WS_THICKFRAME); |
| 483 | 483 |
| 484 LONG ext_styles = ::GetWindowLong(native_window, GWL_EXSTYLE); | 484 LONG ext_styles = ::GetWindowLong(native_window, GWL_EXSTYLE); |
| 485 EXPECT_EQ(WS_EX_TOPMOST, ext_styles & WS_EX_TOPMOST); | 485 EXPECT_EQ(WS_EX_TOPMOST, ext_styles & WS_EX_TOPMOST); |
| 486 #endif | 486 #endif |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 // TODO(jianli): Investigate why this fails on win trunk build. | 606 // TODO(jianli): Investigate why this fails on win trunk build. |
| 607 // http://crbug.com/102734 | 607 // http://crbug.com/102734 |
| 608 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, DISABLED_DrawAttention) { | 608 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, DISABLED_DrawAttention) { |
| 609 TestDrawAttention(); | 609 TestDrawAttention(); |
| 610 } | 610 } |
| 611 | 611 |
| 612 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, ChangeAutoHideTaskBarThickness) { | 612 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, ChangeAutoHideTaskBarThickness) { |
| 613 TestChangeAutoHideTaskBarThickness(); | 613 TestChangeAutoHideTaskBarThickness(); |
| 614 } | 614 } |
| 615 #endif | 615 #endif |
| OLD | NEW |