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

Side by Side Diff: chromeos/display/output_configurator_unittest.cc

Issue 22605008: chromeos: Make OutputConfigurator save latest config. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix interpretation of XRRSetCrtcConfig return value Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chromeos/display/output_configurator.h" 5 #include "chromeos/display/output_configurator.h"
6 6
7 #include <cstdarg> 7 #include <cstdarg>
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 return false; 141 return false;
142 142
143 if (width) 143 if (width)
144 *width = it->second.width; 144 *width = it->second.width;
145 if (height) 145 if (height)
146 *height = it->second.height; 146 *height = it->second.height;
147 if (interlaced) 147 if (interlaced)
148 *interlaced = it->second.interlaced; 148 *interlaced = it->second.interlaced;
149 return true; 149 return true;
150 } 150 }
151 virtual void ConfigureCrtc(OutputConfigurator::CrtcConfig* config) OVERRIDE { 151 virtual bool ConfigureCrtc(RRCrtc crtc,
152 AppendAction(GetCrtcAction(config->crtc, config->x, config->y, config->mode, 152 RRMode mode,
153 config->output)); 153 RROutput output,
154 int x,
155 int y) OVERRIDE {
156 AppendAction(GetCrtcAction(crtc, x, y, mode, output));
157 return true;
154 } 158 }
155 virtual void CreateFrameBuffer( 159 virtual void CreateFrameBuffer(
156 int width, 160 int width,
157 int height, 161 int height,
158 const std::vector<OutputConfigurator::CrtcConfig>& configs) OVERRIDE { 162 const std::vector<OutputConfigurator::OutputSnapshot>& outputs) OVERRIDE {
159 AppendAction( 163 AppendAction(
160 GetFramebufferAction(width, 164 GetFramebufferAction(width,
161 height, 165 height,
162 configs.size() >= 1 ? configs[0].crtc : 0, 166 outputs.size() >= 1 ? outputs[0].crtc : 0,
163 configs.size() >= 2 ? configs[1].crtc : 0)); 167 outputs.size() >= 2 ? outputs[1].crtc : 0));
164 } 168 }
165 virtual void ConfigureCTM( 169 virtual void ConfigureCTM(
166 int touch_device_id, 170 int touch_device_id,
167 const OutputConfigurator::CoordinateTransformation& ctm) OVERRIDE { 171 const OutputConfigurator::CoordinateTransformation& ctm) OVERRIDE {
168 AppendAction(GetCTMAction(touch_device_id, ctm)); 172 AppendAction(GetCTMAction(touch_device_id, ctm));
169 } 173 }
170 virtual void SendProjectingStateToPowerManager(bool projecting) OVERRIDE { 174 virtual void SendProjectingStateToPowerManager(bool projecting) OVERRIDE {
171 AppendAction(projecting ? kProjectingOn : kProjectingOff); 175 AppendAction(projecting ? kProjectingOn : kProjectingOff);
172 } 176 }
173 177
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 configurator_.set_state_controller(&state_controller_); 260 configurator_.set_state_controller(&state_controller_);
257 configurator_.set_mirroring_controller(&mirroring_controller_); 261 configurator_.set_mirroring_controller(&mirroring_controller_);
258 262
259 OutputConfigurator::OutputSnapshot* o = &outputs_[0]; 263 OutputConfigurator::OutputSnapshot* o = &outputs_[0];
260 o->output = 1; 264 o->output = 1;
261 o->crtc = 10; 265 o->crtc = 10;
262 o->current_mode = kSmallModeId; 266 o->current_mode = kSmallModeId;
263 o->native_mode = kSmallModeId; 267 o->native_mode = kSmallModeId;
264 o->selected_mode = kSmallModeId; 268 o->selected_mode = kSmallModeId;
265 o->mirror_mode = kSmallModeId; 269 o->mirror_mode = kSmallModeId;
270 o->x = 0;
266 o->y = 0; 271 o->y = 0;
267 o->height = kSmallModeHeight;
268 o->is_internal = true; 272 o->is_internal = true;
269 o->is_aspect_preserving_scaling = true; 273 o->is_aspect_preserving_scaling = true;
270 o->touch_device_id = 0; 274 o->touch_device_id = 0;
271 o->has_display_id = true; 275 o->has_display_id = true;
272 276
273 o = &outputs_[1]; 277 o = &outputs_[1];
274 o->output = 2; 278 o->output = 2;
275 o->crtc = 11; 279 o->crtc = 11;
276 o->current_mode = kBigModeId; 280 o->current_mode = kBigModeId;
277 o->native_mode = kBigModeId; 281 o->native_mode = kBigModeId;
278 o->selected_mode = kBigModeId; 282 o->selected_mode = kBigModeId;
279 o->mirror_mode = kSmallModeId; 283 o->mirror_mode = kSmallModeId;
284 o->x = 0;
280 o->y = 0; 285 o->y = 0;
281 o->height = kBigModeHeight;
282 o->is_internal = false; 286 o->is_internal = false;
283 o->is_aspect_preserving_scaling = true; 287 o->is_aspect_preserving_scaling = true;
284 o->touch_device_id = 0; 288 o->touch_device_id = 0;
285 o->has_display_id = true; 289 o->has_display_id = true;
286 290
287 UpdateOutputs(2); 291 UpdateOutputs(2);
288 delegate_->AddMode(kSmallModeId, kSmallModeWidth, kSmallModeHeight, false); 292 delegate_->AddMode(kSmallModeId, kSmallModeWidth, kSmallModeHeight, false);
289 delegate_->AddMode(kBigModeId, kBigModeWidth, kBigModeHeight, false); 293 delegate_->AddMode(kBigModeId, kBigModeWidth, kBigModeHeight, false);
290 } 294 }
291 295
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 test_api_.SendOutputChangeEvents(true); 761 test_api_.SendOutputChangeEvents(true);
758 EXPECT_EQ(STATE_DUAL_EXTENDED, configurator_.output_state()); 762 EXPECT_EQ(STATE_DUAL_EXTENDED, configurator_.output_state());
759 763
760 outputs_[0].has_display_id = true; 764 outputs_[0].has_display_id = true;
761 UpdateOutputs(2); 765 UpdateOutputs(2);
762 test_api_.SendOutputChangeEvents(true); 766 test_api_.SendOutputChangeEvents(true);
763 EXPECT_EQ(STATE_DUAL_MIRROR, configurator_.output_state()); 767 EXPECT_EQ(STATE_DUAL_MIRROR, configurator_.output_state());
764 } 768 }
765 769
766 } // namespace chromeos 770 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/display/output_configurator.cc ('k') | chromeos/display/real_output_configurator_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698