| OLD | NEW | 
|    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/update_display_configuration_task.h" |    5 #include "ui/display/manager/chromeos/update_display_configuration_task.h" | 
|    6  |    6  | 
|    7 #include <stddef.h> |    7 #include <stddef.h> | 
|    8  |    8  | 
|    9 #include <utility> |    9 #include <utility> | 
|   10  |   10  | 
|   11 #include "base/bind.h" |   11 #include "base/bind.h" | 
|   12 #include "base/macros.h" |   12 #include "base/macros.h" | 
|   13 #include "base/memory/ptr_util.h" |   13 #include "base/memory/ptr_util.h" | 
|   14 #include "base/message_loop/message_loop.h" |   14 #include "base/message_loop/message_loop.h" | 
|   15 #include "base/run_loop.h" |   15 #include "base/run_loop.h" | 
|   16 #include "testing/gtest/include/gtest/gtest.h" |   16 #include "testing/gtest/include/gtest/gtest.h" | 
|   17 #include "ui/display/chromeos/display_layout_manager.h" |  | 
|   18 #include "ui/display/chromeos/test/action_logger_util.h" |  | 
|   19 #include "ui/display/chromeos/test/test_native_display_delegate.h" |  | 
|   20 #include "ui/display/fake_display_snapshot.h" |   17 #include "ui/display/fake_display_snapshot.h" | 
 |   18 #include "ui/display/manager/chromeos/display_layout_manager.h" | 
 |   19 #include "ui/display/manager/chromeos/test/action_logger_util.h" | 
 |   20 #include "ui/display/manager/chromeos/test/test_native_display_delegate.h" | 
|   21  |   21  | 
|   22 namespace ui { |   22 namespace ui { | 
|   23 namespace test { |   23 namespace test { | 
|   24  |   24  | 
|   25 namespace { |   25 namespace { | 
|   26  |   26  | 
|   27 class TestSoftwareMirroringController |   27 class TestSoftwareMirroringController | 
|   28     : public DisplayConfigurator::SoftwareMirroringController { |   28     : public DisplayConfigurator::SoftwareMirroringController { | 
|   29  public: |   29  public: | 
|   30   TestSoftwareMirroringController() : is_enabled_(false) {} |   30   TestSoftwareMirroringController() : is_enabled_(false) {} | 
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  437         &delegate_, &layout_manager_, MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, |  437         &delegate_, &layout_manager_, MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, | 
|  438         chromeos::DISPLAY_POWER_ALL_ON, 0, 0, false, |  438         chromeos::DISPLAY_POWER_ALL_ON, 0, 0, false, | 
|  439         base::Bind(&UpdateDisplayConfigurationTaskTest::ResponseCallback, |  439         base::Bind(&UpdateDisplayConfigurationTaskTest::ResponseCallback, | 
|  440                    base::Unretained(this))); |  440                    base::Unretained(this))); | 
|  441     task.Run(); |  441     task.Run(); | 
|  442   } |  442   } | 
|  443  |  443  | 
|  444   EXPECT_TRUE(configuration_status_); |  444   EXPECT_TRUE(configuration_status_); | 
|  445   EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, display_state_); |  445   EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, display_state_); | 
|  446   EXPECT_TRUE(layout_manager_.GetSoftwareMirroringController() |  446   EXPECT_TRUE(layout_manager_.GetSoftwareMirroringController() | 
|  447               ->SoftwareMirroringEnabled()); |  447                   ->SoftwareMirroringEnabled()); | 
|  448   EXPECT_EQ(JoinActions(kGrab, kUngrab, nullptr), log_.GetActionsAndClear()); |  448   EXPECT_EQ(JoinActions(kGrab, kUngrab, nullptr), log_.GetActionsAndClear()); | 
|  449 } |  449 } | 
|  450  |  450  | 
|  451 TEST_F(UpdateDisplayConfigurationTaskTest, |  451 TEST_F(UpdateDisplayConfigurationTaskTest, | 
|  452        ForceConfigurationWhileGoingToSoftwareMirror) { |  452        ForceConfigurationWhileGoingToSoftwareMirror) { | 
|  453   layout_manager_.set_should_mirror(false); |  453   layout_manager_.set_should_mirror(false); | 
|  454   layout_manager_.set_software_mirroring_controller( |  454   layout_manager_.set_software_mirroring_controller( | 
|  455       base::MakeUnique<TestSoftwareMirroringController>()); |  455       base::MakeUnique<TestSoftwareMirroringController>()); | 
|  456   UpdateDisplays(2); |  456   UpdateDisplays(2); | 
|  457  |  457  | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
|  471         &delegate_, &layout_manager_, MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, |  471         &delegate_, &layout_manager_, MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, | 
|  472         chromeos::DISPLAY_POWER_ALL_ON, 0, 0, true /* force_configure */, |  472         chromeos::DISPLAY_POWER_ALL_ON, 0, 0, true /* force_configure */, | 
|  473         base::Bind(&UpdateDisplayConfigurationTaskTest::ResponseCallback, |  473         base::Bind(&UpdateDisplayConfigurationTaskTest::ResponseCallback, | 
|  474                    base::Unretained(this))); |  474                    base::Unretained(this))); | 
|  475     task.Run(); |  475     task.Run(); | 
|  476   } |  476   } | 
|  477  |  477  | 
|  478   EXPECT_TRUE(configuration_status_); |  478   EXPECT_TRUE(configuration_status_); | 
|  479   EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, display_state_); |  479   EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, display_state_); | 
|  480   EXPECT_TRUE(layout_manager_.GetSoftwareMirroringController() |  480   EXPECT_TRUE(layout_manager_.GetSoftwareMirroringController() | 
|  481               ->SoftwareMirroringEnabled()); |  481                   ->SoftwareMirroringEnabled()); | 
|  482   EXPECT_EQ( |  482   EXPECT_EQ( | 
|  483       JoinActions( |  483       JoinActions( | 
|  484           kGrab, GetFramebufferAction(gfx::Size(big_mode_.size().width(), |  484           kGrab, GetFramebufferAction(gfx::Size(big_mode_.size().width(), | 
|  485                                                 small_mode_.size().height() + |  485                                                 small_mode_.size().height() + | 
|  486                                                     big_mode_.size().height()), |  486                                                     big_mode_.size().height()), | 
|  487                                       displays_[0].get(), displays_[1].get()) |  487                                       displays_[0].get(), displays_[1].get()) | 
|  488                      .c_str(), |  488                      .c_str(), | 
|  489           GetCrtcAction(*displays_[0], &small_mode_, gfx::Point()).c_str(), |  489           GetCrtcAction(*displays_[0], &small_mode_, gfx::Point()).c_str(), | 
|  490           GetCrtcAction(*displays_[1], &big_mode_, |  490           GetCrtcAction(*displays_[1], &big_mode_, | 
|  491                         gfx::Point(0, small_mode_.size().height())) |  491                         gfx::Point(0, small_mode_.size().height())) | 
|  492               .c_str(), |  492               .c_str(), | 
|  493           kUngrab, nullptr), |  493           kUngrab, nullptr), | 
|  494       log_.GetActionsAndClear()); |  494       log_.GetActionsAndClear()); | 
|  495 } |  495 } | 
|  496  |  496  | 
|  497 }  // namespace test |  497 }  // namespace test | 
|  498 }  // namespace ui |  498 }  // namespace ui | 
| OLD | NEW |