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

Side by Side Diff: trunk/src/ash/shell_unittest.cc

Issue 14200034: Revert 194578 "Add ash SessionStateDelegate" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 8 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 | « trunk/src/ash/shell_delegate.h ('k') | trunk/src/ash/system/date/tray_date.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) 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/shell.h" 5 #include "ash/shell.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
11 #include "ash/desktop_background/desktop_background_widget_controller.h" 11 #include "ash/desktop_background/desktop_background_widget_controller.h"
12 #include "ash/launcher/launcher.h" 12 #include "ash/launcher/launcher.h"
13 #include "ash/root_window_controller.h" 13 #include "ash/root_window_controller.h"
14 #include "ash/session_state_delegate.h"
15 #include "ash/shelf/shelf_layout_manager.h" 14 #include "ash/shelf/shelf_layout_manager.h"
16 #include "ash/shelf/shelf_widget.h" 15 #include "ash/shelf/shelf_widget.h"
16 #include "ash/shell_delegate.h"
17 #include "ash/shell_window_ids.h" 17 #include "ash/shell_window_ids.h"
18 #include "ash/test/ash_test_base.h" 18 #include "ash/test/ash_test_base.h"
19 #include "ash/wm/root_window_layout_manager.h" 19 #include "ash/wm/root_window_layout_manager.h"
20 #include "ash/wm/window_util.h" 20 #include "ash/wm/window_util.h"
21 #include "base/utf_string_conversions.h" 21 #include "base/utf_string_conversions.h"
22 #include "ui/aura/client/aura_constants.h" 22 #include "ui/aura/client/aura_constants.h"
23 #include "ui/aura/root_window.h" 23 #include "ui/aura/root_window.h"
24 #include "ui/aura/window.h" 24 #include "ui/aura/window.h"
25 #include "ui/gfx/size.h" 25 #include "ui/gfx/size.h"
26 #include "ui/views/widget/widget.h" 26 #include "ui/views/widget/widget.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 views::Widget::InitParams::TYPE_WINDOW); 212 views::Widget::InitParams::TYPE_WINDOW);
213 213
214 // Create a normal window. 214 // Create a normal window.
215 views::Widget* widget = CreateTestWindow(widget_params); 215 views::Widget* widget = CreateTestWindow(widget_params);
216 widget->Show(); 216 widget->Show();
217 217
218 // It should be in default container. 218 // It should be in default container.
219 EXPECT_TRUE(GetDefaultContainer()->Contains( 219 EXPECT_TRUE(GetDefaultContainer()->Contains(
220 widget->GetNativeWindow()->parent())); 220 widget->GetNativeWindow()->parent()));
221 221
222 Shell::GetInstance()->session_state_delegate()->LockScreen(); 222 Shell::GetInstance()->delegate()->LockScreen();
223 // Create a LockScreen window. 223 // Create a LockScreen window.
224 views::Widget* lock_widget = CreateTestWindow(widget_params); 224 views::Widget* lock_widget = CreateTestWindow(widget_params);
225 ash::Shell::GetContainer( 225 ash::Shell::GetContainer(
226 Shell::GetPrimaryRootWindow(), 226 Shell::GetPrimaryRootWindow(),
227 ash::internal::kShellWindowId_LockScreenContainer)-> 227 ash::internal::kShellWindowId_LockScreenContainer)->
228 AddChild(lock_widget->GetNativeView()); 228 AddChild(lock_widget->GetNativeView());
229 lock_widget->Show(); 229 lock_widget->Show();
230 230
231 // It should be in LockScreen container. 231 // It should be in LockScreen container.
232 aura::Window* lock_screen = Shell::GetContainer( 232 aura::Window* lock_screen = Shell::GetContainer(
(...skipping 24 matching lines...) Expand all
257 ash::internal::kShellWindowId_SystemModalContainer); 257 ash::internal::kShellWindowId_SystemModalContainer);
258 EXPECT_EQ(modal_container, modal_widget->GetNativeWindow()->parent()); 258 EXPECT_EQ(modal_container, modal_widget->GetNativeWindow()->parent());
259 259
260 modal_widget->Close(); 260 modal_widget->Close();
261 lock_modal_widget->Close(); 261 lock_modal_widget->Close();
262 lock_widget->Close(); 262 lock_widget->Close();
263 widget->Close(); 263 widget->Close();
264 } 264 }
265 265
266 TEST_F(ShellTest, IsScreenLocked) { 266 TEST_F(ShellTest, IsScreenLocked) {
267 SessionStateDelegate* delegate = 267 ash::Shell::GetInstance()->delegate()->LockScreen();
268 Shell::GetInstance()->session_state_delegate(); 268 EXPECT_TRUE(Shell::GetInstance()->IsScreenLocked());
269 delegate->LockScreen(); 269 ash::Shell::GetInstance()->delegate()->UnlockScreen();
270 EXPECT_TRUE(delegate->IsScreenLocked()); 270 EXPECT_FALSE(Shell::GetInstance()->IsScreenLocked());
271 delegate->UnlockScreen();
272 EXPECT_FALSE(delegate->IsScreenLocked());
273 } 271 }
274 272
275 // Fails on Mac, see http://crbug.com/115662 273 // Fails on Mac, see http://crbug.com/115662
276 #if defined(OS_MACOSX) 274 #if defined(OS_MACOSX)
277 #define MAYBE_ManagedWindowModeBasics DISABLED_ManagedWindowModeBasics 275 #define MAYBE_ManagedWindowModeBasics DISABLED_ManagedWindowModeBasics
278 #else 276 #else
279 #define MAYBE_ManagedWindowModeBasics ManagedWindowModeBasics 277 #define MAYBE_ManagedWindowModeBasics ManagedWindowModeBasics
280 #endif 278 #endif
281 TEST_F(ShellTest, MAYBE_ManagedWindowModeBasics) { 279 TEST_F(ShellTest, MAYBE_ManagedWindowModeBasics) {
282 Shell* shell = Shell::GetInstance(); 280 Shell* shell = Shell::GetInstance();
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 private: 412 private:
415 DISALLOW_COPY_AND_ASSIGN(ShellTest2); 413 DISALLOW_COPY_AND_ASSIGN(ShellTest2);
416 }; 414 };
417 415
418 TEST_F(ShellTest2, DontCrashWhenWindowDeleted) { 416 TEST_F(ShellTest2, DontCrashWhenWindowDeleted) {
419 window_.reset(new aura::Window(NULL)); 417 window_.reset(new aura::Window(NULL));
420 window_->Init(ui::LAYER_NOT_DRAWN); 418 window_->Init(ui::LAYER_NOT_DRAWN);
421 } 419 }
422 420
423 } // namespace ash 421 } // namespace ash
OLDNEW
« no previous file with comments | « trunk/src/ash/shell_delegate.h ('k') | trunk/src/ash/system/date/tray_date.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698