summaryrefslogtreecommitdiffstats
path: root/ash/test
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-15 22:58:36 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-15 22:58:36 +0000
commitc39be8f0c897d5f57305e3a36b2a5f74ea15d3e1 (patch)
tree6bd0961a3987a0ab4585ffdb4120974b25e285ef /ash/test
parent481a4b7f34565ef087c8aa44c8e04f9f0e466b2d (diff)
downloadchromium_src-c39be8f0c897d5f57305e3a36b2a5f74ea15d3e1.zip
chromium_src-c39be8f0c897d5f57305e3a36b2a5f74ea15d3e1.tar.gz
chromium_src-c39be8f0c897d5f57305e3a36b2a5f74ea15d3e1.tar.bz2
Basic tests for extended desktop mode
BUG=123160 TEST=extended_desktop_unittests Review URL: https://chromiumcodereview.appspot.com/10536187 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142513 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/test')
-rw-r--r--ash/test/ash_test_base.cc23
-rw-r--r--ash/test/ash_test_base.h9
2 files changed, 32 insertions, 0 deletions
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc
index ad9066b..323790c 100644
--- a/ash/test/ash_test_base.cc
+++ b/ash/test/ash_test_base.cc
@@ -4,10 +4,12 @@
#include "ash/test/ash_test_base.h"
+#include <string>
#include <vector>
#include "ash/shell.h"
#include "ash/test/test_shell_delegate.h"
+#include "base/string_split.h"
#include "content/public/test/web_contents_tester.h"
#include "ui/aura/env.h"
#include "ui/aura/monitor_manager.h"
@@ -19,6 +21,21 @@
namespace ash {
namespace test {
+namespace {
+
+std::vector<gfx::Display> CreateDisplaysFromString(
+ const std::string specs) {
+ std::vector<gfx::Display> displays;
+ std::vector<std::string> parts;
+ base::SplitString(specs, ',', &parts);
+ for (std::vector<std::string>::const_iterator iter = parts.begin();
+ iter != parts.end(); ++iter) {
+ displays.push_back(aura::MonitorManager::CreateMonitorFromSpec(*iter));
+ }
+ return displays;
+}
+
+} // namespace
content::WebContents* AshTestViewsDelegate::CreateWebContents(
content::BrowserContext* browser_context,
@@ -65,6 +82,12 @@ void AshTestBase::ChangeMonitorConfig(float scale,
displays);
}
+void AshTestBase::UpdateMonitor(const std::string& display_specs) {
+ std::vector<gfx::Display> displays = CreateDisplaysFromString(display_specs);
+ aura::Env::GetInstance()->monitor_manager()->
+ OnNativeMonitorsChanged(displays);
+}
+
void AshTestBase::RunAllPendingInMessageLoop() {
#if !defined(OS_MACOSX)
message_loop_.RunAllPendingWithDispatcher(
diff --git a/ash/test/ash_test_base.h b/ash/test/ash_test_base.h
index 2ca9246..559b370 100644
--- a/ash/test/ash_test_base.h
+++ b/ash/test/ash_test_base.h
@@ -6,6 +6,8 @@
#define ASH_TEST_ASH_TEST_BASE_H_
#pragma once
+#include <string>
+
#include "ash/shell.h"
#include "base/compiler_specific.h"
#include "base/message_loop.h"
@@ -38,6 +40,13 @@ class AshTestBase : public testing::Test {
// and |scale|.
void ChangeMonitorConfig(float scale, const gfx::Rect& bounds);
+ // Update the display configuration as given in |display_specs|. The
+ // format of |display_spec| is a list of comma separated spec for
+ // each displays. Please refer to the comment in
+ // | aura::MonitorManager::CreateMonitorFromSpec| for the format of
+ // the display spec.
+ void UpdateMonitor(const std::string& display_specs);
+
protected:
void RunAllPendingInMessageLoop();