diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-10 19:28:45 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-10 19:28:45 +0000 |
commit | 6d980bca39d438f54288695389ed163bbf505f82 (patch) | |
tree | ceb467ec051a371fbe9986cd2d95adab14c161da /chromeos/display | |
parent | e666aaf5251e3272da232ba2ce5f0a039da259f4 (diff) | |
download | chromium_src-6d980bca39d438f54288695389ed163bbf505f82.zip chromium_src-6d980bca39d438f54288695389ed163bbf505f82.tar.gz chromium_src-6d980bca39d438f54288695389ed163bbf505f82.tar.bz2 |
Don't update display info when brightness is set to 0, or device goes to sleep/suspend.
In either case, the display info will be updated properly
when they're turned on, so no need to change them when disconnected.
BUG=145627, 146899
TEST=added new tests. also tested manually. See bug for repro step (145627)
Review URL: https://chromiumcodereview.appspot.com/10917159
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155798 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/display')
-rw-r--r-- | chromeos/display/output_configurator.cc | 14 | ||||
-rw-r--r-- | chromeos/display/output_configurator.h | 3 | ||||
-rw-r--r-- | chromeos/display/output_configurator_unittest.cc | 28 |
3 files changed, 38 insertions, 7 deletions
diff --git a/chromeos/display/output_configurator.cc b/chromeos/display/output_configurator.cc index 85e37a6..389e327 100644 --- a/chromeos/display/output_configurator.cc +++ b/chromeos/display/output_configurator.cc @@ -250,14 +250,9 @@ static int GetDualOutputs(Display* display, to_populate->mirror_mode = 0; // See if this output refers to an internal display. - const char* name = output_info->name; to_populate->is_internal = - (strncmp(kInternal_LVDS, - name, - arraysize(kInternal_LVDS) - 1) == 0) || - (strncmp(kInternal_eDP, - name, - arraysize(kInternal_eDP) - 1) == 0); + OutputConfigurator::IsInternalOutputName( + std::string(output_info->name)); VLOG(1) << "Found display #" << found_count << " with output " << (int)to_populate->output @@ -802,6 +797,11 @@ void OutputConfigurator::RemoveObserver(Observer* observer) { observers_.RemoveObserver(observer); } +// static +bool OutputConfigurator::IsInternalOutputName(const std::string& name) { + return name.find(kInternal_LVDS) == 0 || name.find(kInternal_eDP) == 0; +} + void OutputConfigurator::NotifyOnDisplayChanged() { FOR_EACH_OBSERVER(Observer, observers_, OnDisplayModeChanged()); } diff --git a/chromeos/display/output_configurator.h b/chromeos/display/output_configurator.h index 557b473..ca03bfd 100644 --- a/chromeos/display/output_configurator.h +++ b/chromeos/display/output_configurator.h @@ -82,6 +82,9 @@ class CHROMEOS_EXPORT OutputConfigurator : public MessageLoop::Dispatcher { void AddObserver(Observer* observer); void RemoveObserver(Observer* observer); + // Tells if the output specified by |name| is for internal display. + static bool IsInternalOutputName(const std::string& name); + private: // Fires OnDisplayModeChanged() event to the observers. void NotifyOnDisplayChanged(); diff --git a/chromeos/display/output_configurator_unittest.cc b/chromeos/display/output_configurator_unittest.cc new file mode 100644 index 0000000..f8d9e12 --- /dev/null +++ b/chromeos/display/output_configurator_unittest.cc @@ -0,0 +1,28 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromeos/display/output_configurator.h" + +#include <string> + +#include "testing/gtest/include/gtest/gtest.h" + +namespace chromeos { + +typedef testing::Test OutputConfiguratorTest; + +TEST_F(OutputConfiguratorTest, IsInternalOutputName) { + EXPECT_TRUE(OutputConfigurator::IsInternalOutputName("LVDS")); + EXPECT_TRUE(OutputConfigurator::IsInternalOutputName("eDP")); + EXPECT_TRUE(OutputConfigurator::IsInternalOutputName("LVDSxx")); + EXPECT_TRUE(OutputConfigurator::IsInternalOutputName("eDPzz")); + + EXPECT_FALSE(OutputConfigurator::IsInternalOutputName("xyz")); + EXPECT_FALSE(OutputConfigurator::IsInternalOutputName("abcLVDS")); + EXPECT_FALSE(OutputConfigurator::IsInternalOutputName("cdeeDP")); + EXPECT_FALSE(OutputConfigurator::IsInternalOutputName("LVD")); + EXPECT_FALSE(OutputConfigurator::IsInternalOutputName("eD")); +} + +} // namespace chromeos |