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

Side by Side Diff: ash/test/ash_test_base.cc

Issue 21519002: Prevent mouse from getting stuck on second display in login (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: don't create target window if a session is already active Created 7 years, 4 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/test/ash_test_base.h ('k') | ash/test/ash_test_helper.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/test/ash_test_base.h" 5 #include "ash/test/ash_test_base.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 content::BrowserContext* browser_context, 77 content::BrowserContext* browser_context,
78 content::SiteInstance* site_instance) { 78 content::SiteInstance* site_instance) {
79 return content::WebContentsTester::CreateTestWebContents(browser_context, 79 return content::WebContentsTester::CreateTestWebContents(browser_context,
80 site_instance); 80 site_instance);
81 } 81 }
82 82
83 ///////////////////////////////////////////////////////////////////////////// 83 /////////////////////////////////////////////////////////////////////////////
84 84
85 AshTestBase::AshTestBase() 85 AshTestBase::AshTestBase()
86 : setup_called_(false), 86 : setup_called_(false),
87 teardown_called_(false) { 87 teardown_called_(false),
88 start_session_(true) {
88 // Must initialize |ash_test_helper_| here because some tests rely on 89 // Must initialize |ash_test_helper_| here because some tests rely on
89 // AshTestBase methods before they call AshTestBase::SetUp(). 90 // AshTestBase methods before they call AshTestBase::SetUp().
90 ash_test_helper_.reset(new AshTestHelper(base::MessageLoopForUI::current())); 91 ash_test_helper_.reset(new AshTestHelper(base::MessageLoopForUI::current()));
91 } 92 }
92 93
93 AshTestBase::~AshTestBase() { 94 AshTestBase::~AshTestBase() {
94 CHECK(setup_called_) 95 CHECK(setup_called_)
95 << "You have overridden SetUp but never called AshTestBase::SetUp"; 96 << "You have overridden SetUp but never called AshTestBase::SetUp";
96 CHECK(teardown_called_) 97 CHECK(teardown_called_)
97 << "You have overridden TearDown but never called AshTestBase::TearDown"; 98 << "You have overridden TearDown but never called AshTestBase::TearDown";
98 } 99 }
99 100
100 void AshTestBase::SetUp() { 101 void AshTestBase::SetUp() {
101 setup_called_ = true; 102 setup_called_ = true;
102 // TODO(jamescook): Can we do this without changing command line? 103 // TODO(jamescook): Can we do this without changing command line?
103 // Use the origin (1,1) so that it doesn't over 104 // Use the origin (1,1) so that it doesn't over
104 // lap with the native mouse cursor. 105 // lap with the native mouse cursor.
105 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 106 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
106 switches::kAshHostWindowBounds, "1+1-800x600"); 107 switches::kAshHostWindowBounds, "1+1-800x600");
107 #if defined(OS_WIN) 108 #if defined(OS_WIN)
108 aura::test::SetUsePopupAsRootWindowForTest(true); 109 aura::test::SetUsePopupAsRootWindowForTest(true);
109 #endif 110 #endif
110 ui::InitializeInputMethodForTesting(); 111 ui::InitializeInputMethodForTesting();
111 112
112 ash_test_helper_->SetUp(); 113 ash_test_helper_->SetUp(start_session_);
113 114
114 Shell::GetPrimaryRootWindow()->Show(); 115 Shell::GetPrimaryRootWindow()->Show();
115 Shell::GetPrimaryRootWindow()->ShowRootWindow(); 116 Shell::GetPrimaryRootWindow()->ShowRootWindow();
116 // Move the mouse cursor to far away so that native events doesn't 117 // Move the mouse cursor to far away so that native events doesn't
117 // interfere test expectations. 118 // interfere test expectations.
118 Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000)); 119 Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000));
119 ash::Shell::GetInstance()->cursor_manager()->EnableMouseEvents(); 120 ash::Shell::GetInstance()->cursor_manager()->EnableMouseEvents();
120 121
121 #if defined(OS_WIN) 122 #if defined(OS_WIN)
122 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && 123 if (base::win::GetVersion() >= base::win::VERSION_WIN8 &&
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 318
318 void AshTestBase::UnblockUserSession() { 319 void AshTestBase::UnblockUserSession() {
319 Shell::GetInstance()->session_state_delegate()->UnlockScreen(); 320 Shell::GetInstance()->session_state_delegate()->UnlockScreen();
320 SetSessionStarted(true); 321 SetSessionStarted(true);
321 SetUserAddingScreenRunning(false); 322 SetUserAddingScreenRunning(false);
322 } 323 }
323 324
324 325
325 } // namespace test 326 } // namespace test
326 } // namespace ash 327 } // namespace ash
OLDNEW
« no previous file with comments | « ash/test/ash_test_base.h ('k') | ash/test/ash_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698