chromeos: Include mode details in OutputSnapshot.

This updates OutputConfigurator to include modes'
resolutions and interlaced-ness in OutputSnapshot structs,
and to pass OutputSnapshots to observers after the display
mode is changed.

A following change will update ash's
DisplayChangeObserverX11 class to use OutputSnapshots
instead of asking the X server for the same information via
XRandR.

BUG=266113

Review URL: https://chromiumcodereview.appspot.com/22871010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@218069 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chromeos/display/output_configurator_unittest.cc b/chromeos/display/output_configurator_unittest.cc
index 6769e51..0749399 100644
--- a/chromeos/display/output_configurator_unittest.cc
+++ b/chromeos/display/output_configurator_unittest.cc
@@ -114,11 +114,6 @@
     return actions;
   }
 
-  // Adds a mode to be returned by GetModeDetails().
-  void AddMode(RRMode mode, int width, int height, bool interlaced) {
-    modes_[mode] = ModeDetails(width, height, interlaced);
-  }
-
   // OutputConfigurator::Delegate overrides:
   virtual void SetPanelFittingEnabled(bool enabled) OVERRIDE {}
   virtual void InitXRandRExtension(int* event_base) OVERRIDE {
@@ -138,23 +133,6 @@
       const OutputConfigurator::StateController* controller) OVERRIDE {
     return outputs_;
   }
-  virtual bool GetModeDetails(
-      RRMode mode,
-      int* width,
-      int* height,
-      bool* interlaced) OVERRIDE {
-    std::map<RRMode, ModeDetails>::const_iterator it = modes_.find(mode);
-    if (it == modes_.end())
-      return false;
-
-    if (width)
-      *width = it->second.width;
-    if (height)
-      *height = it->second.height;
-    if (interlaced)
-      *interlaced = it->second.interlaced;
-    return true;
-  }
   virtual bool ConfigureCrtc(RRCrtc crtc,
                              RRMode mode,
                              RROutput output,
@@ -270,6 +248,14 @@
     configurator_.set_state_controller(&state_controller_);
     configurator_.set_mirroring_controller(&mirroring_controller_);
 
+    OutputConfigurator::ModeInfo small_mode_info;
+    small_mode_info.width = kSmallModeWidth;
+    small_mode_info.height = kSmallModeHeight;
+
+    OutputConfigurator::ModeInfo big_mode_info;
+    big_mode_info.width = kBigModeWidth;
+    big_mode_info.height = kBigModeHeight;
+
     OutputConfigurator::OutputSnapshot* o = &outputs_[0];
     o->output = 1;
     o->crtc = 10;
@@ -281,6 +267,7 @@
     o->y = 0;
     o->is_internal = true;
     o->is_aspect_preserving_scaling = true;
+    o->mode_infos[kSmallModeId] = small_mode_info;
     o->touch_device_id = 0;
     o->has_display_id = true;
 
@@ -295,12 +282,12 @@
     o->y = 0;
     o->is_internal = false;
     o->is_aspect_preserving_scaling = true;
+    o->mode_infos[kSmallModeId] = small_mode_info;
+    o->mode_infos[kBigModeId] = big_mode_info;
     o->touch_device_id = 0;
     o->has_display_id = true;
 
     UpdateOutputs(2, false);
-    delegate_->AddMode(kSmallModeId, kSmallModeWidth, kSmallModeHeight, false);
-    delegate_->AddMode(kBigModeId, kBigModeWidth, kBigModeHeight, false);
   }
 
   void DisableNativeMirroring() {
@@ -704,9 +691,7 @@
             delegate_->GetActionsAndClear());
 
   // Connect an external display and check that it's configured correctly.
-  outputs_[0].is_internal = false;
-  outputs_[0].native_mode = kBigModeId;
-  outputs_[0].selected_mode = kBigModeId;
+  outputs_[0] = outputs_[1];
   UpdateOutputs(1, true);
   EXPECT_EQ(JoinActions(kUpdateXRandR, kGrab,
                         GetFramebufferAction(kBigModeWidth, kBigModeHeight,