| OLD | NEW |
| 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 "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/launcher/launcher.h" | 8 #include "ash/launcher/launcher.h" |
| 9 #include "ash/launcher/launcher_model.h" | 9 #include "ash/launcher/launcher_model.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); | 435 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); |
| 436 EXPECT_TRUE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); | 436 EXPECT_TRUE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); |
| 437 | 437 |
| 438 // Add window for app1. This will activate it. | 438 // Add window for app1. This will activate it. |
| 439 ShellWindow* window1b = CreateShellWindow(extension1); | 439 ShellWindow* window1b = CreateShellWindow(extension1); |
| 440 ash::wm::ActivateWindow(window1b->GetNativeWindow()); | 440 ash::wm::ActivateWindow(window1b->GetNativeWindow()); |
| 441 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); | 441 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); |
| 442 EXPECT_FALSE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); | 442 EXPECT_FALSE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); |
| 443 EXPECT_TRUE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); | 443 EXPECT_TRUE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); |
| 444 | 444 |
| 445 // Activate launcher item for app1, this will cycle the active window. | 445 // Activate launcher item for app1, this will activate the first app window. |
| 446 launcher_->ActivateLauncherItem(launcher_model()->ItemIndexByID(item_id1)); | 446 launcher_->ActivateLauncherItem(launcher_model()->ItemIndexByID(item_id1)); |
| 447 EXPECT_TRUE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); |
| 447 EXPECT_FALSE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); | 448 EXPECT_FALSE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); |
| 449 launcher_->ActivateLauncherItem(launcher_model()->ItemIndexByID(item_id1)); |
| 448 EXPECT_TRUE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); | 450 EXPECT_TRUE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); |
| 449 launcher_->ActivateLauncherItem(launcher_model()->ItemIndexByID(item_id1)); | |
| 450 EXPECT_TRUE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); | |
| 451 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); | |
| 452 | 451 |
| 453 // Activate the second app again | 452 // Activate the second app again |
| 454 launcher_->ActivateLauncherItem(launcher_model()->ItemIndexByID(item_id2)); | 453 launcher_->ActivateLauncherItem(launcher_model()->ItemIndexByID(item_id2)); |
| 455 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); | 454 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); |
| 456 EXPECT_TRUE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); | 455 EXPECT_TRUE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); |
| 457 EXPECT_FALSE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); | 456 EXPECT_FALSE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); |
| 458 | 457 |
| 459 // Activate the first app again | 458 // Activate the first app again |
| 460 launcher_->ActivateLauncherItem(launcher_model()->ItemIndexByID(item_id1)); | 459 launcher_->ActivateLauncherItem(launcher_model()->ItemIndexByID(item_id1)); |
| 461 EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); | 460 EXPECT_TRUE(ash::wm::IsActiveWindow(window1->GetNativeWindow())); |
| 462 EXPECT_FALSE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); | 461 EXPECT_FALSE(ash::wm::IsActiveWindow(window2->GetNativeWindow())); |
| 463 EXPECT_TRUE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); | 462 EXPECT_FALSE(ash::wm::IsActiveWindow(window1b->GetNativeWindow())); |
| 464 | 463 |
| 465 // Close second app. | 464 // Close second app. |
| 466 CloseShellWindow(window2); | 465 CloseShellWindow(window2); |
| 467 --item_count; | 466 --item_count; |
| 468 EXPECT_EQ(item_count, launcher_model()->item_count()); | 467 EXPECT_EQ(item_count, launcher_model()->item_count()); |
| 469 // First app should be active again. | 468 // First app should be active again. |
| 470 EXPECT_EQ(ash::STATUS_ACTIVE, launcher_model()->ItemByID(item_id1)->status); | 469 EXPECT_EQ(ash::STATUS_ACTIVE, launcher_model()->ItemByID(item_id1)->status); |
| 471 | 470 |
| 472 // Close first app. | 471 // Close first app. |
| 473 CloseShellWindow(window1b); | 472 CloseShellWindow(window1b); |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 | 818 |
| 820 // Now show overflow bubble. | 819 // Now show overflow bubble. |
| 821 test.ShowOverflowBubble(); | 820 test.ShowOverflowBubble(); |
| 822 EXPECT_TRUE(launcher_->IsShowingOverflowBubble()); | 821 EXPECT_TRUE(launcher_->IsShowingOverflowBubble()); |
| 823 | 822 |
| 824 // Unpin first pinned app and there should be no crash. | 823 // Unpin first pinned app and there should be no crash. |
| 825 ChromeLauncherController* controller = | 824 ChromeLauncherController* controller = |
| 826 static_cast<ChromeLauncherController*>(launcher_->delegate()); | 825 static_cast<ChromeLauncherController*>(launcher_->delegate()); |
| 827 controller->UnpinAppsWithID(std::string("fake_app_0")); | 826 controller->UnpinAppsWithID(std::string("fake_app_0")); |
| 828 } | 827 } |
| OLD | NEW |