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

Unified Diff: ash/screen_util_unittest.cc

Issue 2067223003: Parameterize Ash unittests to pass with material design enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for further feedback Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: ash/screen_util_unittest.cc
diff --git a/ash/screen_util_unittest.cc b/ash/screen_util_unittest.cc
index 2fe76958f9d85133b8106c72f2458722acccef5a..a2031fe4c15215b432d8339fb426816129a8d10c 100644
--- a/ash/screen_util_unittest.cc
+++ b/ash/screen_util_unittest.cc
@@ -6,7 +6,7 @@
#include "ash/display/display_manager.h"
#include "ash/shell.h"
-#include "ash/test/ash_test_base.h"
+#include "ash/test/ash_md_test_base.h"
#include "ash/test/display_manager_test_api.h"
#include "ash/wm/window_util.h"
#include "ui/aura/env.h"
@@ -18,11 +18,21 @@
namespace ash {
namespace test {
-typedef test::AshTestBase ScreenUtilTest;
+typedef test::AshMDTestBase ScreenUtilTest;
-TEST_F(ScreenUtilTest, Bounds) {
+// Note: First argument is optional and intentionally left blank.
+// (it's a prefix for the generated test cases)
+INSTANTIATE_TEST_CASE_P(
+ ,
+ ScreenUtilTest,
+ testing::Values(ash::MaterialDesignController::NON_MATERIAL,
+ ash::MaterialDesignController::MATERIAL_NORMAL,
+ ash::MaterialDesignController::MATERIAL_EXPERIMENTAL));
+
+TEST_P(ScreenUtilTest, Bounds) {
if (!SupportsMultipleDisplays())
return;
+ const int height_offset = GetMdMaximizedWindowHeightOffset();
UpdateDisplay("600x600,500x500");
views::Widget* primary = views::Widget::CreateWindowWithContextAndBounds(
@@ -33,10 +43,10 @@ TEST_F(ScreenUtilTest, Bounds) {
secondary->Show();
// Maximized bounds. By default the shelf is 47px tall (ash::kShelfSize).
- EXPECT_EQ("0,0 600x553", ScreenUtil::GetMaximizedWindowBoundsInParent(
- primary->GetNativeView())
- .ToString());
- EXPECT_EQ("0,0 500x453",
+ EXPECT_EQ(gfx::Rect(0, 0, 600, 553 + height_offset).ToString(),
+ ScreenUtil::GetMaximizedWindowBoundsInParent(
+ primary->GetNativeView()).ToString());
+ EXPECT_EQ(gfx::Rect(0, 0, 500, 453 + height_offset).ToString(),
ScreenUtil::GetMaximizedWindowBoundsInParent(
secondary->GetNativeView()).ToString());
@@ -49,17 +59,17 @@ TEST_F(ScreenUtilTest, Bounds) {
secondary->GetNativeView()).ToString());
// Work area bounds
- EXPECT_EQ("0,0 600x553", ScreenUtil::GetDisplayWorkAreaBoundsInParent(
- primary->GetNativeView())
- .ToString());
- EXPECT_EQ("0,0 500x453",
+ EXPECT_EQ(gfx::Rect(0, 0, 600, 553 + height_offset).ToString(),
+ ScreenUtil::GetDisplayWorkAreaBoundsInParent(
+ primary->GetNativeView()).ToString());
+ EXPECT_EQ(gfx::Rect(0, 0, 500, 453 + height_offset).ToString(),
ScreenUtil::GetDisplayWorkAreaBoundsInParent(
secondary->GetNativeView()).ToString());
}
// Test verifies a stable handling of secondary screen widget changes
// (crbug.com/226132).
-TEST_F(ScreenUtilTest, StabilityTest) {
+TEST_P(ScreenUtilTest, StabilityTest) {
if (!SupportsMultipleDisplays())
return;
@@ -76,7 +86,7 @@ TEST_F(ScreenUtilTest, StabilityTest) {
secondary->Close();
}
-TEST_F(ScreenUtilTest, ConvertRect) {
+TEST_P(ScreenUtilTest, ConvertRect) {
if (!SupportsMultipleDisplays())
return;
@@ -108,7 +118,7 @@ TEST_F(ScreenUtilTest, ConvertRect) {
secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString());
}
-TEST_F(ScreenUtilTest, ShelfDisplayBoundsInUnifiedDesktop) {
+TEST_P(ScreenUtilTest, ShelfDisplayBoundsInUnifiedDesktop) {
if (!SupportsMultipleDisplays())
return;
DisplayManager* display_manager = Shell::GetInstance()->display_manager();

Powered by Google App Engine
This is Rietveld 408576698