| Index: ash/monitor/multi_monitor_manager_unittest.cc
|
| diff --git a/ash/monitor/multi_monitor_manager_unittest.cc b/ash/monitor/multi_monitor_manager_unittest.cc
|
| index afd0013721c5746a872d01b880a6cbbf58f5d549..905c0d4232f26591655734497bdb295132970f68 100644
|
| --- a/ash/monitor/multi_monitor_manager_unittest.cc
|
| +++ b/ash/monitor/multi_monitor_manager_unittest.cc
|
| @@ -7,26 +7,26 @@
|
| #include "ash/shell.h"
|
| #include "ash/test/ash_test_base.h"
|
| #include "base/format_macros.h"
|
| -#include "base/stl_util.h"
|
| #include "base/string_split.h"
|
| #include "base/stringprintf.h"
|
| #include "ui/aura/env.h"
|
| -#include "ui/aura/monitor.h"
|
| +#include "ui/aura/monitor_observer.h"
|
| #include "ui/aura/root_window.h"
|
| #include "ui/aura/window_observer.h"
|
| +#include "ui/gfx/monitor.h"
|
|
|
| namespace ash {
|
| namespace test {
|
|
|
| using std::vector;
|
| using std::string;
|
| -using aura::Monitor;
|
| +using gfx::Monitor;
|
|
|
| namespace {
|
|
|
| -vector<const aura::Monitor*> CreateMonitorsFromString(
|
| +vector<Monitor> CreateMonitorsFromString(
|
| const std::string specs) {
|
| - vector<const aura::Monitor*> monitors;
|
| + vector<Monitor> monitors;
|
| vector<string> parts;
|
| base::SplitString(specs, ',', &parts);
|
| for (vector<string>::const_iterator iter = parts.begin();
|
| @@ -62,8 +62,8 @@ class MultiMonitorManagerTest : public test::AshTestBase,
|
| aura::MonitorManager* monitor_manager() {
|
| return aura::Env::GetInstance()->monitor_manager();
|
| }
|
| - const vector<const Monitor*>& changed() const { return changed_; }
|
| - const vector<const Monitor*>& added() const { return added_; }
|
| + const vector<Monitor>& changed() const { return changed_; }
|
| + const vector<Monitor>& added() const { return added_; }
|
|
|
| string GetCountSummary() const {
|
| return StringPrintf("%"PRIuS" %"PRIuS" %"PRIuS,
|
| @@ -82,13 +82,13 @@ class MultiMonitorManagerTest : public test::AshTestBase,
|
| }
|
|
|
| // aura::MonitorObserver overrides:
|
| - virtual void OnMonitorBoundsChanged(const Monitor* monitor) OVERRIDE {
|
| + virtual void OnMonitorBoundsChanged(const Monitor& monitor) OVERRIDE {
|
| changed_.push_back(monitor);
|
| }
|
| - virtual void OnMonitorAdded(Monitor* new_monitor) OVERRIDE {
|
| + virtual void OnMonitorAdded(const Monitor& new_monitor) OVERRIDE {
|
| added_.push_back(new_monitor);
|
| }
|
| - virtual void OnMonitorRemoved(const Monitor* old_monitor) OVERRIDE {
|
| + virtual void OnMonitorRemoved(const Monitor& old_monitor) OVERRIDE {
|
| ++removed_count_;
|
| }
|
|
|
| @@ -99,14 +99,13 @@ class MultiMonitorManagerTest : public test::AshTestBase,
|
| }
|
|
|
| void UpdateMonitor(const std::string str) {
|
| - vector<const aura::Monitor*> monitors = CreateMonitorsFromString(str);
|
| + vector<Monitor> monitors = CreateMonitorsFromString(str);
|
| monitor_manager()->OnNativeMonitorsChanged(monitors);
|
| - STLDeleteContainerPointers(monitors.begin(), monitors.end());
|
| }
|
|
|
| private:
|
| - vector<const Monitor*> changed_;
|
| - vector<const Monitor*> added_;
|
| + vector<Monitor> changed_;
|
| + vector<Monitor> added_;
|
| size_t removed_count_;
|
| bool root_window_destroyed_;
|
|
|
| @@ -122,10 +121,10 @@ TEST_F(MultiMonitorManagerTest, NativeMonitorTest) {
|
| UpdateMonitor("0+0-500x500,0+501-400x400");
|
| EXPECT_EQ(2U, monitor_manager()->GetNumMonitors());
|
| EXPECT_EQ("1 1 0", GetCountSummary());
|
| - EXPECT_EQ(monitor_manager()->GetMonitorAt(0), changed()[0]);
|
| - EXPECT_EQ(monitor_manager()->GetMonitorAt(1), added()[0]);
|
| - EXPECT_EQ("0,0 500x500", changed()[0]->bounds().ToString());
|
| - EXPECT_EQ("0,501 400x400", added()[0]->bounds().ToString());
|
| + EXPECT_EQ(monitor_manager()->GetMonitorAt(0).id(), changed()[0].id());
|
| + EXPECT_EQ(monitor_manager()->GetMonitorAt(1).id(), added()[0].id());
|
| + EXPECT_EQ("0,0 500x500", changed()[0].bounds().ToString());
|
| + EXPECT_EQ("0,501 400x400", added()[0].bounds().ToString());
|
| reset();
|
|
|
| // Delete secondary.
|
| @@ -136,35 +135,35 @@ TEST_F(MultiMonitorManagerTest, NativeMonitorTest) {
|
| // Change primary.
|
| UpdateMonitor("0+0-1000x600");
|
| EXPECT_EQ("1 0 0", GetCountSummary());
|
| - EXPECT_EQ(monitor_manager()->GetMonitorAt(0), changed()[0]);
|
| - EXPECT_EQ("0,0 1000x600", changed()[0]->bounds().ToString());
|
| + EXPECT_EQ(monitor_manager()->GetMonitorAt(0).id(), changed()[0].id());
|
| + EXPECT_EQ("0,0 1000x600", changed()[0].bounds().ToString());
|
| reset();
|
|
|
| // Add secondary.
|
| UpdateMonitor("0+0-1000x600,1001+0-600x400");
|
| EXPECT_EQ(2U, monitor_manager()->GetNumMonitors());
|
| EXPECT_EQ("0 1 0", GetCountSummary());
|
| - EXPECT_EQ(monitor_manager()->GetMonitorAt(1), added()[0]);
|
| - EXPECT_EQ("1001,0 600x400", added()[0]->bounds().ToString());
|
| + EXPECT_EQ(monitor_manager()->GetMonitorAt(1).id(), added()[0].id());
|
| + EXPECT_EQ("1001,0 600x400", added()[0].bounds().ToString());
|
| reset();
|
|
|
| // Secondary removed, primary changed.
|
| UpdateMonitor("0+0-800x300");
|
| EXPECT_EQ(1U, monitor_manager()->GetNumMonitors());
|
| EXPECT_EQ("1 0 1", GetCountSummary());
|
| - EXPECT_EQ(monitor_manager()->GetMonitorAt(0), changed()[0]);
|
| - EXPECT_EQ("0,0 800x300", changed()[0]->bounds().ToString());
|
| + EXPECT_EQ(monitor_manager()->GetMonitorAt(0).id(), changed()[0].id());
|
| + EXPECT_EQ("0,0 800x300", changed()[0].bounds().ToString());
|
| reset();
|
|
|
| // # of monitor can go to zero when screen is off.
|
| - const vector<const Monitor*> empty;
|
| + const vector<Monitor> empty;
|
| monitor_manager()->OnNativeMonitorsChanged(empty);
|
| EXPECT_EQ(1U, monitor_manager()->GetNumMonitors());
|
| EXPECT_EQ("0 0 0", GetCountSummary());
|
| EXPECT_FALSE(root_window_destroyed());
|
| // Monitor configuration stays the same
|
| EXPECT_EQ("0,0 800x300",
|
| - monitor_manager()->GetMonitorAt(0)->bounds().ToString());
|
| + monitor_manager()->GetMonitorAt(0).bounds().ToString());
|
| reset();
|
|
|
| // Connect to monitor again
|
| @@ -172,7 +171,7 @@ TEST_F(MultiMonitorManagerTest, NativeMonitorTest) {
|
| EXPECT_EQ(1U, monitor_manager()->GetNumMonitors());
|
| EXPECT_EQ("1 0 0", GetCountSummary());
|
| EXPECT_FALSE(root_window_destroyed());
|
| - EXPECT_EQ("100,100 500x400", changed()[0]->bounds().ToString());
|
| + EXPECT_EQ("100,100 500x400", changed()[0].bounds().ToString());
|
| reset();
|
|
|
| // Go back to zero and wake up with multiple monitors.
|
| @@ -185,9 +184,9 @@ TEST_F(MultiMonitorManagerTest, NativeMonitorTest) {
|
| UpdateMonitor("0+0-1000x600,1000+0-600x400");
|
| EXPECT_EQ(2U, monitor_manager()->GetNumMonitors());
|
| EXPECT_EQ("0,0 1000x600",
|
| - monitor_manager()->GetMonitorAt(0)->bounds().ToString());
|
| + monitor_manager()->GetMonitorAt(0).bounds().ToString());
|
| EXPECT_EQ("1000,0 600x400",
|
| - monitor_manager()->GetMonitorAt(1)->bounds().ToString());
|
| + monitor_manager()->GetMonitorAt(1).bounds().ToString());
|
| reset();
|
|
|
| aura::MonitorManager::set_use_fullscreen_host_window(false);
|
|
|