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

Side by Side Diff: ash/shell_unittest.cc

Issue 9600006: Aura: Remove overlapping window mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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/shell.cc ('k') | ash/test/ash_test_base.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/ash_switches.h" 5 #include "ash/ash_switches.h"
6 #include "ash/launcher/launcher.h" 6 #include "ash/launcher/launcher.h"
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/test/ash_test_base.h" 9 #include "ash/test/ash_test_base.h"
10 #include "ash/wm/root_window_layout_manager.h" 10 #include "ash/wm/root_window_layout_manager.h"
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 CommandLine command_line_blank(CommandLine::NO_PROGRAM); 294 CommandLine command_line_blank(CommandLine::NO_PROGRAM);
295 EXPECT_EQ(Shell::MODE_MANAGED, 295 EXPECT_EQ(Shell::MODE_MANAGED,
296 test_api.ComputeWindowMode(&command_line_blank)); 296 test_api.ComputeWindowMode(&command_line_blank));
297 297
298 // Sometimes we force compact mode. 298 // Sometimes we force compact mode.
299 CommandLine command_line_force(CommandLine::NO_PROGRAM); 299 CommandLine command_line_force(CommandLine::NO_PROGRAM);
300 command_line_force.AppendSwitch(switches::kAuraForceCompactWindowMode); 300 command_line_force.AppendSwitch(switches::kAuraForceCompactWindowMode);
301 EXPECT_EQ(Shell::MODE_COMPACT, 301 EXPECT_EQ(Shell::MODE_COMPACT,
302 test_api.ComputeWindowMode(&command_line_force)); 302 test_api.ComputeWindowMode(&command_line_force));
303 303
304 // The user can set overlapping mode.
305 CommandLine command_line_overlapping(CommandLine::NO_PROGRAM);
306 command_line_overlapping.AppendSwitchASCII(
307 switches::kAuraWindowMode,
308 switches::kAuraWindowModeOverlapping);
309 EXPECT_EQ(Shell::MODE_OVERLAPPING,
310 test_api.ComputeWindowMode(&command_line_overlapping));
311
312 // The user can set compact mode. 304 // The user can set compact mode.
313 CommandLine command_line_compact(CommandLine::NO_PROGRAM); 305 CommandLine command_line_compact(CommandLine::NO_PROGRAM);
314 command_line_compact.AppendSwitchASCII(switches::kAuraWindowMode, 306 command_line_compact.AppendSwitchASCII(switches::kAuraWindowMode,
315 switches::kAuraWindowModeCompact); 307 switches::kAuraWindowModeCompact);
316 EXPECT_EQ(Shell::MODE_COMPACT, 308 EXPECT_EQ(Shell::MODE_COMPACT,
317 test_api.ComputeWindowMode(&command_line_compact)); 309 test_api.ComputeWindowMode(&command_line_compact));
318 310
319 // The user can set managed. 311 // The user can set managed.
320 CommandLine command_line_managed(CommandLine::NO_PROGRAM); 312 CommandLine command_line_managed(CommandLine::NO_PROGRAM);
321 command_line_managed.AppendSwitchASCII(switches::kAuraWindowMode, 313 command_line_managed.AppendSwitchASCII(switches::kAuraWindowMode,
322 switches::kAuraWindowModeManaged); 314 switches::kAuraWindowModeManaged);
323 EXPECT_EQ(Shell::MODE_MANAGED, 315 EXPECT_EQ(Shell::MODE_MANAGED,
324 test_api.ComputeWindowMode(&command_line_managed)); 316 test_api.ComputeWindowMode(&command_line_managed));
325 } 317 }
326 318
327 // Fails on Mac, see http://crbug.com/115662 319 // Fails on Mac, see http://crbug.com/115662
328 #if defined(OS_MACOSX) 320 #if defined(OS_MACOSX)
329 #define MAYBE_OverlappingWindowModeBasics FAILS_OverlappingWindowModeBasics 321 #define MAYBE_ManagedWindowModeBasics FAILS_ManagedWindowModeBasics
330 #else 322 #else
331 #define MAYBE_OverlappingWindowModeBasics OverlappingWindowModeBasics 323 #define MAYBE_ManagedWindowModeBasics ManagedWindowModeBasics
332 #endif 324 #endif
333 TEST_F(ShellTest, MAYBE_OverlappingWindowModeBasics) { 325 TEST_F(ShellTest, MAYBE_ManagedWindowModeBasics) {
334 Shell* shell = Shell::GetInstance(); 326 Shell* shell = Shell::GetInstance();
335 Shell::TestApi test_api(shell); 327 Shell::TestApi test_api(shell);
336 328
337 // We start with the usual window containers. 329 // We start with the usual window containers.
338 ExpectAllContainers(); 330 ExpectAllContainers();
339 // We're not in compact window mode by default. 331 // We're not in compact window mode by default.
340 EXPECT_FALSE(shell->IsWindowModeCompact()); 332 EXPECT_FALSE(shell->IsWindowModeCompact());
341 // We have a default container event filter (for window drags). 333 // We have a default container event filter (for window drags).
342 EXPECT_TRUE(GetDefaultContainer()->event_filter()); 334 EXPECT_TRUE(GetDefaultContainer()->event_filter());
343 // Launcher is visible. 335 // Launcher is visible.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 EXPECT_FALSE(Shell::GetInstance()->shelf()->visible()); 374 EXPECT_FALSE(Shell::GetInstance()->shelf()->visible());
383 375
384 // Restoring the window restores it. 376 // Restoring the window restores it.
385 widget->Restore(); 377 widget->Restore();
386 EXPECT_TRUE(Shell::GetInstance()->shelf()->visible()); 378 EXPECT_TRUE(Shell::GetInstance()->shelf()->visible());
387 379
388 // Clean up. 380 // Clean up.
389 widget->Close(); 381 widget->Close();
390 } 382 }
391 383
392 // Window mode is computed at Shell initialization time. Rather than changing 384 // By implementing GetOverrideWindowMode we make the Shell come up in compact
393 // the global command line to select compact mode we set a switch before 385 // window mode.
394 // initializing the shell.
395 class ShellCompactWindowModeTest : public test::AshTestBase { 386 class ShellCompactWindowModeTest : public test::AshTestBase {
396 public: 387 public:
397 ShellCompactWindowModeTest() {} 388 ShellCompactWindowModeTest() {}
398 virtual ~ShellCompactWindowModeTest() {} 389 virtual ~ShellCompactWindowModeTest() {}
399 390
400 virtual void SetUp() OVERRIDE { 391 protected:
401 // Must set this before base class initializes the shell. 392 virtual bool GetOverrideWindowMode(Shell::WindowMode* window_mode) {
402 Shell::set_compact_window_mode_for_test(true); 393 *window_mode = Shell::MODE_COMPACT;
403 test::AshTestBase::SetUp(); 394 return true;
404 }
405
406 virtual void TearDown() OVERRIDE {
407 test::AshTestBase::TearDown();
408 Shell::set_compact_window_mode_for_test(false);
409 } 395 }
410 396
411 private: 397 private:
412 DISALLOW_COPY_AND_ASSIGN(ShellCompactWindowModeTest); 398 DISALLOW_COPY_AND_ASSIGN(ShellCompactWindowModeTest);
413 }; 399 };
414 400
415 TEST_F(ShellCompactWindowModeTest, CompactWindowModeBasics) { 401 TEST_F(ShellCompactWindowModeTest, CompactWindowModeBasics) {
416 Shell* shell = Shell::GetInstance(); 402 Shell* shell = Shell::GetInstance();
417 Shell::TestApi test_api(shell); 403 Shell::TestApi test_api(shell);
418 404
(...skipping 22 matching lines...) Expand all
441 EXPECT_FALSE(launcher_widget->IsVisible()); 427 EXPECT_FALSE(launcher_widget->IsVisible());
442 // Desktop background widget is gone but we have a layer. 428 // Desktop background widget is gone but we have a layer.
443 EXPECT_FALSE(test_api.root_window_layout()->background_widget()); 429 EXPECT_FALSE(test_api.root_window_layout()->background_widget());
444 EXPECT_TRUE(test_api.root_window_layout()->background_layer()); 430 EXPECT_TRUE(test_api.root_window_layout()->background_layer());
445 431
446 // Clean up. 432 // Clean up.
447 widget->Close(); 433 widget->Close();
448 } 434 }
449 435
450 } // namespace ash 436 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell.cc ('k') | ash/test/ash_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698