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

Side by Side Diff: ui/display/chromeos/display_configurator_unittest.cc

Issue 1019623002: Remove DisplayState from the public interface for DisplayConfigurator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « ui/display/chromeos/display_configurator.cc ('k') | ui/display/chromeos/display_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/display/chromeos/display_configurator.h" 5 #include "ui/display/chromeos/display_configurator.h"
6 6
7 #include "base/memory/scoped_vector.h" 7 #include "base/memory/scoped_vector.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/display/chromeos/test/action_logger_util.h" 10 #include "ui/display/chromeos/test/action_logger_util.h"
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); 847 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR);
848 configurator_.ForceInitialConfigure(0); 848 configurator_.ForceInitialConfigure(0);
849 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, configurator_.display_state()); 849 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, configurator_.display_state());
850 } 850 }
851 851
852 TEST_F(DisplayConfiguratorTest, UpdateCachedOutputsEvenAfterFailure) { 852 TEST_F(DisplayConfiguratorTest, UpdateCachedOutputsEvenAfterFailure) {
853 InitWithSingleOutput(); 853 InitWithSingleOutput();
854 const DisplayConfigurator::DisplayStateList* cached = 854 const DisplayConfigurator::DisplayStateList* cached =
855 &configurator_.cached_displays(); 855 &configurator_.cached_displays();
856 ASSERT_EQ(static_cast<size_t>(1), cached->size()); 856 ASSERT_EQ(static_cast<size_t>(1), cached->size());
857 EXPECT_EQ(outputs_[0].current_mode(), (*cached)[0].display->current_mode()); 857 EXPECT_EQ(outputs_[0].current_mode(), (*cached)[0]->current_mode());
858 858
859 // After connecting a second output, check that it shows up in 859 // After connecting a second output, check that it shows up in
860 // |cached_displays_| even if an invalid state is requested. 860 // |cached_displays_| even if an invalid state is requested.
861 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_SINGLE); 861 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_SINGLE);
862 UpdateOutputs(2, true); 862 UpdateOutputs(2, true);
863 cached = &configurator_.cached_displays(); 863 cached = &configurator_.cached_displays();
864 ASSERT_EQ(static_cast<size_t>(2), cached->size()); 864 ASSERT_EQ(static_cast<size_t>(2), cached->size());
865 EXPECT_EQ(outputs_[0].current_mode(), (*cached)[0].display->current_mode()); 865 EXPECT_EQ(outputs_[0].current_mode(), (*cached)[0]->current_mode());
866 EXPECT_EQ(outputs_[1].current_mode(), (*cached)[1].display->current_mode()); 866 EXPECT_EQ(outputs_[1].current_mode(), (*cached)[1]->current_mode());
867 } 867 }
868 868
869 TEST_F(DisplayConfiguratorTest, PanelFitting) { 869 TEST_F(DisplayConfiguratorTest, PanelFitting) {
870 // Configure the internal display to support only the big mode and the 870 // Configure the internal display to support only the big mode and the
871 // external display to support only the small mode. 871 // external display to support only the small mode.
872 outputs_[0].set_current_mode(&big_mode_); 872 outputs_[0].set_current_mode(&big_mode_);
873 outputs_[0].set_native_mode(&big_mode_); 873 outputs_[0].set_native_mode(&big_mode_);
874 outputs_[0].set_modes(std::vector<const DisplayMode*>(1, &big_mode_)); 874 outputs_[0].set_modes(std::vector<const DisplayMode*>(1, &big_mode_));
875 875
876 outputs_[1].set_current_mode(&small_mode_); 876 outputs_[1].set_current_mode(&small_mode_);
(...skipping 14 matching lines...) Expand all
891 GetFramebufferAction(small_mode_.size(), &outputs_[0], &outputs_[1]) 891 GetFramebufferAction(small_mode_.size(), &outputs_[0], &outputs_[1])
892 .c_str(), 892 .c_str(),
893 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 893 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
894 GetCrtcAction(outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(), 894 GetCrtcAction(outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(),
895 kForceDPMS, kUngrab, NULL), 895 kForceDPMS, kUngrab, NULL),
896 log_->GetActionsAndClear()); 896 log_->GetActionsAndClear());
897 897
898 // Both outputs should be using the small mode. 898 // Both outputs should be using the small mode.
899 ASSERT_EQ(1, observer_.num_changes()); 899 ASSERT_EQ(1, observer_.num_changes());
900 ASSERT_EQ(static_cast<size_t>(2), observer_.latest_outputs().size()); 900 ASSERT_EQ(static_cast<size_t>(2), observer_.latest_outputs().size());
901 EXPECT_EQ(&small_mode_, observer_.latest_outputs()[0].mirror_mode); 901 EXPECT_EQ(&small_mode_, observer_.latest_outputs()[0]->current_mode());
902 EXPECT_EQ(&small_mode_, 902 EXPECT_EQ(&small_mode_, observer_.latest_outputs()[1]->current_mode());
903 observer_.latest_outputs()[0].display->current_mode());
904 EXPECT_EQ(&small_mode_, observer_.latest_outputs()[1].mirror_mode);
905 EXPECT_EQ(&small_mode_,
906 observer_.latest_outputs()[1].display->current_mode());
907 903
908 // Also check that the newly-added small mode is present in the internal 904 // Also check that the newly-added small mode is present in the internal
909 // snapshot that was passed to the observer (http://crbug.com/289159). 905 // snapshot that was passed to the observer (http://crbug.com/289159).
910 const DisplayConfigurator::DisplayState& state = 906 DisplaySnapshot* state = observer_.latest_outputs()[0];
911 observer_.latest_outputs()[0]; 907 ASSERT_NE(
912 ASSERT_NE(state.display->modes().end(), 908 state->modes().end(),
913 std::find(state.display->modes().begin(), 909 std::find(state->modes().begin(), state->modes().end(), &small_mode_));
914 state.display->modes().end(),
915 &small_mode_));
916 } 910 }
917 911
918 TEST_F(DisplayConfiguratorTest, ContentProtection) { 912 TEST_F(DisplayConfiguratorTest, ContentProtection) {
919 configurator_.Init(false); 913 configurator_.Init(false);
920 configurator_.ForceInitialConfigure(0); 914 configurator_.ForceInitialConfigure(0);
921 EXPECT_NE(kNoActions, log_->GetActionsAndClear()); 915 EXPECT_NE(kNoActions, log_->GetActionsAndClear());
922 916
923 DisplayConfigurator::ContentProtectionClientId id = 917 DisplayConfigurator::ContentProtectionClientId id =
924 configurator_.RegisterContentProtectionClient(); 918 configurator_.RegisterContentProtectionClient();
925 EXPECT_NE(0u, id); 919 EXPECT_NE(0u, id);
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 GetFramebufferAction(small_mode_.size(), &outputs_[0], 1342 GetFramebufferAction(small_mode_.size(), &outputs_[0],
1349 nullptr).c_str(), 1343 nullptr).c_str(),
1350 GetCrtcAction(outputs_[0], &small_mode_, 1344 GetCrtcAction(outputs_[0], &small_mode_,
1351 gfx::Point(0, 0)).c_str(), 1345 gfx::Point(0, 0)).c_str(),
1352 kUngrab, NULL), 1346 kUngrab, NULL),
1353 log_->GetActionsAndClear()); 1347 log_->GetActionsAndClear());
1354 } 1348 }
1355 1349
1356 } // namespace test 1350 } // namespace test
1357 } // namespace ui 1351 } // namespace ui
OLDNEW
« no previous file with comments | « ui/display/chromeos/display_configurator.cc ('k') | ui/display/chromeos/display_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698