Chromium Code Reviews| Index: chrome/browser/extensions/display_info_provider_chromeos_unittest.cc |
| diff --git a/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc b/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc |
| index efb4524fa15dc7374b9fc5668cfc76f22f4b173b..b116d3388490b5c8305bd51fd63535e18279d2fd 100644 |
| --- a/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc |
| +++ b/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc |
| @@ -1196,7 +1196,7 @@ TEST_F(DisplayInfoProviderChromeosTest, DisplayMode) { |
| EXPECT_TRUE(active_mode->IsEquivalent(other_mode_ash)); |
| } |
| -TEST_F(DisplayInfoProviderChromeosTest, SetTouchCalibrationInternal) { |
| +TEST_F(DisplayInfoProviderChromeosTest, CustomTouchCalibrationInternal) { |
| UpdateDisplay("1200x600,600x1000*2"); |
| const int64_t internal_display_id = |
| display::test::DisplayManagerTestApi( |
| @@ -1205,23 +1205,37 @@ TEST_F(DisplayInfoProviderChromeosTest, SetTouchCalibrationInternal) { |
| std::string id = base::Int64ToString(internal_display_id); |
| - api::system_display::TouchCalibrationPairQuad pairs; |
| - api::system_display::Bounds bounds; |
| - |
| bool success = false; |
|
Reilly Grant (use Gerrit)
2017/01/18 21:35:56
Declare |success| where it is assigned.
malaykeshav
2017/01/19 01:30:51
Done
|
| std::string error; |
| std::string expected_err = |
| "Display Id(" + id + ") is an internal display." + |
| " Internal displays cannot be calibrated for touch."; |
| + success = DisplayInfoProvider::Get()->StartCustomTouchCalibration(id, &error); |
| + |
| + ASSERT_FALSE(success); |
| + EXPECT_EQ(expected_err, error); |
| +} |
| - success = DisplayInfoProvider::Get()->TouchCalibrationSet(id, pairs, bounds, |
| - &error); |
| +TEST_F(DisplayInfoProviderChromeosTest, CustomTouchCalibrationWithoutStart) { |
| + UpdateDisplay("1200x600,600x1000*2"); |
| + |
| + api::system_display::TouchCalibrationPairQuad pairs; |
| + api::system_display::Bounds bounds; |
| + |
| + bool success = false; |
| + std::string error; |
| + std::string expected_err = |
| + "Please call StartCustomTouchCalibration() before calling this method."; |
| + success = DisplayInfoProvider::Get()->CompleteCustomTouchCalibration(pairs, |
| + bounds, |
| + &error); |
| ASSERT_FALSE(success); |
| EXPECT_EQ(expected_err, error); |
| } |
| -TEST_F(DisplayInfoProviderChromeosTest, SetTouchCalibrationNonTouchDisplay) { |
| + |
| +TEST_F(DisplayInfoProviderChromeosTest, CustomTouchCalibrationNonTouchDisplay) { |
| UpdateDisplay("1200x600,600x1000*2"); |
| const int64_t internal_display_id = |
| @@ -1243,21 +1257,17 @@ TEST_F(DisplayInfoProviderChromeosTest, SetTouchCalibrationNonTouchDisplay) { |
| std::string id = base::Int64ToString(display_id); |
| - api::system_display::TouchCalibrationPairQuad pairs; |
| - api::system_display::Bounds bounds; |
| - |
| bool success = false; |
| std::string error; |
| std::string expected_err = "Display Id(" + id + ") does not support touch."; |
| - success = DisplayInfoProvider::Get()->TouchCalibrationSet(id, pairs, bounds, |
| - &error); |
| + success = DisplayInfoProvider::Get()->StartCustomTouchCalibration(id, &error); |
| ASSERT_FALSE(success); |
| EXPECT_EQ(expected_err, error); |
| } |
| -TEST_F(DisplayInfoProviderChromeosTest, SetTouchCalibrationNegativeBounds) { |
| +TEST_F(DisplayInfoProviderChromeosTest, CustomTouchCalibrationNegativeBounds) { |
| UpdateDisplay("1200x600,600x1000*2"); |
| const int64_t internal_display_id = |
| @@ -1283,8 +1293,10 @@ TEST_F(DisplayInfoProviderChromeosTest, SetTouchCalibrationNegativeBounds) { |
| bool success = false; |
| std::string error; |
| - success = DisplayInfoProvider::Get()->TouchCalibrationSet(id, pairs, bounds, |
| - &error); |
| + DisplayInfoProvider::Get()->StartCustomTouchCalibration(id, &error); |
| + error = ""; |
| + success = DisplayInfoProvider::Get()->CompleteCustomTouchCalibration( |
| + pairs, bounds, &error); |
| std::string expected_err = "Bounds cannot have negative values."; |
| @@ -1295,13 +1307,15 @@ TEST_F(DisplayInfoProviderChromeosTest, SetTouchCalibrationNegativeBounds) { |
| bounds.width = 0; |
| bounds.height = -1; |
| - success = DisplayInfoProvider::Get()->TouchCalibrationSet(id, pairs, bounds, |
| - &error); |
| + DisplayInfoProvider::Get()->StartCustomTouchCalibration(id, &error); |
| + error = ""; |
| + success = DisplayInfoProvider::Get()->CompleteCustomTouchCalibration( |
| + pairs, bounds, &error); |
| ASSERT_FALSE(success); |
| EXPECT_EQ(expected_err, error); |
| } |
| -TEST_F(DisplayInfoProviderChromeosTest, SetTouchCalibrationInvalidPoints) { |
| +TEST_F(DisplayInfoProviderChromeosTest, CustomTouchCalibrationInvalidPoints) { |
| UpdateDisplay("1200x600,600x1000*2"); |
| const int64_t internal_display_id = |
| @@ -1327,8 +1341,10 @@ TEST_F(DisplayInfoProviderChromeosTest, SetTouchCalibrationInvalidPoints) { |
| pairs.pair1.display_point.x = -1; |
| bool success = false; |
| std::string error; |
| - success = DisplayInfoProvider::Get()->TouchCalibrationSet(id, pairs, bounds, |
| - &error); |
| + DisplayInfoProvider::Get()->StartCustomTouchCalibration(id, &error); |
| + error = ""; |
| + success = DisplayInfoProvider::Get()->CompleteCustomTouchCalibration( |
| + pairs, bounds, &error); |
| std::string expected_err = "Display points and touch points cannot have " |
| "negative coordinates"; |
| @@ -1342,13 +1358,15 @@ TEST_F(DisplayInfoProviderChromeosTest, SetTouchCalibrationInvalidPoints) { |
| expected_err = "Display point coordinates cannot be more than size of the " |
| "display."; |
| - success = DisplayInfoProvider::Get()->TouchCalibrationSet(id, pairs, bounds, |
| - &error); |
| + DisplayInfoProvider::Get()->StartCustomTouchCalibration(id, &error); |
| + error = ""; |
| + success = DisplayInfoProvider::Get()->CompleteCustomTouchCalibration( |
| + pairs, bounds, &error); |
| ASSERT_FALSE(success); |
| EXPECT_EQ(expected_err, error); |
| } |
| -TEST_F(DisplayInfoProviderChromeosTest, SetTouchCalibrationSuccess) { |
| +TEST_F(DisplayInfoProviderChromeosTest, CustomTouchCalibrationSuccess) { |
| UpdateDisplay("1200x600,600x1000*2"); |
| const int64_t internal_display_id = |
| @@ -1394,8 +1412,10 @@ TEST_F(DisplayInfoProviderChromeosTest, SetTouchCalibrationSuccess) { |
| bool success = false; |
| std::string error; |
| - success = DisplayInfoProvider::Get()->TouchCalibrationSet(id, pairs, bounds, |
| - &error); |
| + DisplayInfoProvider::Get()->StartCustomTouchCalibration(id, &error); |
| + error = ""; |
| + success = DisplayInfoProvider::Get()->CompleteCustomTouchCalibration( |
| + pairs, bounds, &error); |
| ASSERT_TRUE(success); |
| EXPECT_EQ(error, ""); |