Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "ash/display/display_configuration_controller.h" | 9 #include "ash/display/display_configuration_controller.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "ash/test/ash_test_base.h" | 11 #include "ash/test/ash_test_base.h" |
| 12 #include "base/run_loop.h" | |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "ui/display/display.h" | 14 #include "ui/display/display.h" |
| 14 #include "ui/display/display_observer.h" | 15 #include "ui/display/display_observer.h" |
| 15 #include "ui/display/manager/display_manager.h" | 16 #include "ui/display/manager/display_manager.h" |
| 16 #include "ui/display/screen.h" | 17 #include "ui/display/screen.h" |
| 17 #include "ui/display/test/display_manager_test_api.h" | 18 #include "ui/display/test/display_manager_test_api.h" |
| 18 | 19 |
| 19 namespace chromeos { | 20 namespace chromeos { |
| 20 | 21 |
| 21 namespace { | 22 namespace { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 TEST_F(OobeDisplayChooserTest, PreferTouchAsPrimary) { | 57 TEST_F(OobeDisplayChooserTest, PreferTouchAsPrimary) { |
| 57 OobeDisplayChooser display_chooser; | 58 OobeDisplayChooser display_chooser; |
| 58 | 59 |
| 59 UpdateDisplay("3000x2000,800x600"); | 60 UpdateDisplay("3000x2000,800x600"); |
| 60 display::DisplayIdList ids = display_manager()->GetCurrentDisplayIdList(); | 61 display::DisplayIdList ids = display_manager()->GetCurrentDisplayIdList(); |
| 61 DisableTouch(ids[0]); | 62 DisableTouch(ids[0]); |
| 62 EnableTouch(ids[1]); | 63 EnableTouch(ids[1]); |
| 63 | 64 |
| 64 EXPECT_EQ(ids[0], GetPrimaryDisplay()); | 65 EXPECT_EQ(ids[0], GetPrimaryDisplay()); |
| 65 display_chooser.TryToPlaceUiOnTouchDisplay(); | 66 display_chooser.TryToPlaceUiOnTouchDisplay(); |
| 67 base::RunLoop().RunUntilIdle(); | |
| 66 | 68 |
| 67 EXPECT_EQ(ids[1], GetPrimaryDisplay()); | 69 EXPECT_EQ(ids[1], GetPrimaryDisplay()); |
| 68 } | 70 } |
| 69 | 71 |
| 70 TEST_F(OobeDisplayChooserTest, AddingSecondTouchDisplayShouldbeNOP) { | 72 TEST_F(OobeDisplayChooserTest, AddingSecondTouchDisplayShouldbeNOP) { |
| 71 OobeDisplayChooser display_chooser; | 73 OobeDisplayChooser display_chooser; |
| 72 | 74 |
| 73 UpdateDisplay("3000x2000,800x600"); | 75 UpdateDisplay("3000x2000,800x600"); |
| 74 display::DisplayIdList ids = display_manager()->GetCurrentDisplayIdList(); | 76 display::DisplayIdList ids = display_manager()->GetCurrentDisplayIdList(); |
| 75 EnableTouch(ids[0]); | 77 EnableTouch(ids[0]); |
| 76 EnableTouch(ids[1]); | 78 EnableTouch(ids[1]); |
| 77 | 79 |
| 78 EXPECT_EQ(ids[0], GetPrimaryDisplay()); | 80 EXPECT_EQ(ids[0], GetPrimaryDisplay()); |
| 79 display_chooser.TryToPlaceUiOnTouchDisplay(); | 81 display_chooser.TryToPlaceUiOnTouchDisplay(); |
| 82 base::RunLoop().RunUntilIdle(); | |
| 80 | 83 |
| 81 EXPECT_EQ(ids[0], GetPrimaryDisplay()); | 84 EXPECT_EQ(ids[0], GetPrimaryDisplay()); |
|
oshima
2017/05/17 16:56:18
can you add another test case where the primary di
Felix Ekblom
2017/05/18 11:12:04
I'm not sure I understand what this would test.
I
Felix Ekblom
2017/05/22 14:40:53
I've added a test now that trigger the bad behavio
| |
| 82 } | 85 } |
| 83 | 86 |
| 84 } // namespace chromeos | 87 } // namespace chromeos |
| OLD | NEW |