Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(743)

Side by Side Diff: ash/display/mirror_window_controller_unittest.cc

Issue 23620060: Try to enable software mirror mode in UI message loop after Init() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/display/display_manager.cc ('k') | ash/shell.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "ash/display/mirror_window_controller.h" 5 #include "ash/display/mirror_window_controller.h"
6 6
7 #include "ash/ash_switches.h"
7 #include "ash/display/display_manager.h" 8 #include "ash/display/display_manager.h"
8 #include "ash/shell.h" 9 #include "ash/shell.h"
9 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
10 #include "ash/test/mirror_window_test_api.h" 11 #include "ash/test/mirror_window_test_api.h"
12 #include "base/command_line.h"
11 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
12 #include "ui/aura/root_window.h" 14 #include "ui/aura/root_window.h"
13 #include "ui/aura/test/event_generator.h" 15 #include "ui/aura/test/event_generator.h"
14 #include "ui/aura/test/test_window_delegate.h" 16 #include "ui/aura/test/test_window_delegate.h"
15 #include "ui/aura/test/test_windows.h" 17 #include "ui/aura/test/test_windows.h"
16 #include "ui/aura/window.h" 18 #include "ui/aura/window.h"
17 #include "ui/base/hit_test.h" 19 #include "ui/base/hit_test.h"
18 20
19 namespace ash { 21 namespace ash {
20 namespace internal { 22 namespace internal {
21 23
22 namespace { 24 namespace {
23 DisplayInfo CreateDisplayInfo(int64 id, const gfx::Rect& bounds) { 25 DisplayInfo CreateDisplayInfo(int64 id, const gfx::Rect& bounds) {
24 DisplayInfo info(id, base::StringPrintf("x-%d", static_cast<int>(id)), false); 26 DisplayInfo info(id, base::StringPrintf("x-%d", static_cast<int>(id)), false);
25 info.SetBounds(bounds); 27 info.SetBounds(bounds);
26 return info; 28 return info;
27 } 29 }
28 30
31 class MirrorOnBootTest : public test::AshTestBase {
32 public:
33 MirrorOnBootTest() {}
34 virtual ~MirrorOnBootTest() {}
35
36 virtual void SetUp() OVERRIDE {
37 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
38 switches::kAshHostWindowBounds, "1+1-300x300,1+301-300x300");
39 CommandLine::ForCurrentProcess()->AppendSwitch(
40 switches::kAshEnableSoftwareMirroring);
41 test::AshTestBase::SetUp();
42 }
43 virtual void TearDown() OVERRIDE {
44 test::AshTestBase::TearDown();
45 }
46
47 private:
48 DISALLOW_COPY_AND_ASSIGN(MirrorOnBootTest);
49 };
50
29 } 51 }
30 52
31 typedef test::AshTestBase MirrorWindowControllerTest; 53 typedef test::AshTestBase MirrorWindowControllerTest;
32 54
33 #if defined(OS_WIN) 55 #if defined(OS_WIN)
34 // Software mirroring does not work on win. 56 // Software mirroring does not work on win.
35 #define MAYBE_MirrorCursorBasic DISABLED_MirrorCursorBasic 57 #define MAYBE_MirrorCursorBasic DISABLED_MirrorCursorBasic
36 #define MAYBE_MirrorCursorLocations DISABLED_MirrorCursorLocations 58 #define MAYBE_MirrorCursorLocations DISABLED_MirrorCursorLocations
37 #define MAYBE_MirrorCursorRotate DISABLED_MirrorCursorRotate 59 #define MAYBE_MirrorCursorRotate DISABLED_MirrorCursorRotate
38 #define MAYBE_DockMode DISABLED_DockMode 60 #define MAYBE_DockMode DISABLED_DockMode
61 #define MAYBE_MirrorOnBoot DISABLED_MirrorOnBoot
39 #else 62 #else
40 #define MAYBE_MirrorCursorBasic MirrorCursorBasic 63 #define MAYBE_MirrorCursorBasic MirrorCursorBasic
41 #define MAYBE_MirrorCursorLocations MirrorCursorLocations 64 #define MAYBE_MirrorCursorLocations MirrorCursorLocations
42 #define MAYBE_MirrorCursorRotate MirrorCursorRotate 65 #define MAYBE_MirrorCursorRotate MirrorCursorRotate
43 #define MAYBE_DockMode DockMode 66 #define MAYBE_DockMode DockMode
67 #define MAYBE_MirrorOnBoot MirrorOnBoot
44 #endif 68 #endif
45 69
46 TEST_F(MirrorWindowControllerTest, MAYBE_MirrorCursorBasic) { 70 TEST_F(MirrorWindowControllerTest, MAYBE_MirrorCursorBasic) {
47 test::MirrorWindowTestApi test_api; 71 test::MirrorWindowTestApi test_api;
48 aura::test::TestWindowDelegate test_window_delegate; 72 aura::test::TestWindowDelegate test_window_delegate;
49 test_window_delegate.set_window_component(HTTOP); 73 test_window_delegate.set_window_component(HTTOP);
50 74
51 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 75 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
52 display_manager->SetSoftwareMirroring(true); 76 display_manager->SetSoftwareMirroring(true);
53 UpdateDisplay("400x400,400x400"); 77 UpdateDisplay("400x400,400x400");
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 display_info_list.clear(); 268 display_info_list.clear();
245 display_info_list.push_back(internal_display_info); 269 display_info_list.push_back(internal_display_info);
246 display_info_list.push_back(external_display_info); 270 display_info_list.push_back(external_display_info);
247 display_manager->SetSoftwareMirroring(true); 271 display_manager->SetSoftwareMirroring(true);
248 display_manager->UpdateDisplays(display_info_list); 272 display_manager->UpdateDisplays(display_info_list);
249 EXPECT_EQ(1U, display_manager->GetNumDisplays()); 273 EXPECT_EQ(1U, display_manager->GetNumDisplays());
250 EXPECT_TRUE(display_manager->IsMirrored()); 274 EXPECT_TRUE(display_manager->IsMirrored());
251 EXPECT_EQ(external_id, display_manager->mirrored_display().id()); 275 EXPECT_EQ(external_id, display_manager->mirrored_display().id());
252 } 276 }
253 277
278 TEST_F(MirrorOnBootTest, MAYBE_MirrorOnBoot) {
279 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
280 EXPECT_TRUE(display_manager->IsMirrored());
281 RunAllPendingInMessageLoop();
282 test::MirrorWindowTestApi test_api;
283 EXPECT_TRUE(test_api.GetRootWindow());
284 }
285
254 } // namsspace internal 286 } // namsspace internal
255 } // namespace ash 287 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_manager.cc ('k') | ash/shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698