| 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..a054a5a410d77ece68d7cb40e4c1a88c78417f24 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,36 @@ 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;
|
| std::string error;
|
| std::string expected_err =
|
| "Display Id(" + id + ") is an internal display." +
|
| " Internal displays cannot be calibrated for touch.";
|
| + bool success = DisplayInfoProvider::Get()->StartCustomTouchCalibration(
|
| + id, &error);
|
| +
|
| + ASSERT_FALSE(success);
|
| + EXPECT_EQ(expected_err, error);
|
| +}
|
| +
|
| +TEST_F(DisplayInfoProviderChromeosTest, CustomTouchCalibrationWithoutStart) {
|
| + UpdateDisplay("1200x600,600x1000*2");
|
|
|
| - success = DisplayInfoProvider::Get()->TouchCalibrationSet(id, pairs, bounds,
|
| - &error);
|
| + api::system_display::TouchCalibrationPairQuad pairs;
|
| + api::system_display::Bounds bounds;
|
| +
|
| + std::string error;
|
| + std::string expected_err =
|
| + "Please call system.display.startCustomTouchCalibration before calling "
|
| + "this method.";
|
| + bool 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 +1256,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);
|
| + bool 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 =
|
| @@ -1281,10 +1290,11 @@ TEST_F(DisplayInfoProviderChromeosTest, SetTouchCalibrationNegativeBounds) {
|
| api::system_display::Bounds bounds;
|
| bounds.width = -1;
|
|
|
| - bool success = false;
|
| std::string error;
|
| - success = DisplayInfoProvider::Get()->TouchCalibrationSet(id, pairs, bounds,
|
| - &error);
|
| + DisplayInfoProvider::Get()->StartCustomTouchCalibration(id, &error);
|
| + error = "";
|
| + bool success = DisplayInfoProvider::Get()->CompleteCustomTouchCalibration(
|
| + pairs, bounds, &error);
|
|
|
| std::string expected_err = "Bounds cannot have negative values.";
|
|
|
| @@ -1295,13 +1305,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 =
|
| @@ -1325,10 +1337,11 @@ TEST_F(DisplayInfoProviderChromeosTest, SetTouchCalibrationInvalidPoints) {
|
| api::system_display::Bounds bounds;
|
|
|
| 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 = "";
|
| + bool success = DisplayInfoProvider::Get()->CompleteCustomTouchCalibration(
|
| + pairs, bounds, &error);
|
|
|
| std::string expected_err = "Display points and touch points cannot have "
|
| "negative coordinates";
|
| @@ -1342,13 +1355,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 =
|
| @@ -1392,10 +1407,11 @@ TEST_F(DisplayInfoProviderChromeosTest, SetTouchCalibrationSuccess) {
|
| bounds.width = 600;
|
| bounds.height = 1000;
|
|
|
| - bool success = false;
|
| std::string error;
|
| - success = DisplayInfoProvider::Get()->TouchCalibrationSet(id, pairs, bounds,
|
| - &error);
|
| + DisplayInfoProvider::Get()->StartCustomTouchCalibration(id, &error);
|
| + error = "";
|
| + bool success = DisplayInfoProvider::Get()->CompleteCustomTouchCalibration(
|
| + pairs, bounds, &error);
|
|
|
| ASSERT_TRUE(success);
|
| EXPECT_EQ(error, "");
|
|
|