| OLD | NEW |
| 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 "chrome/browser/ui/ash/launcher/launcher_context_menu.h" | 5 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" |
| 6 | 6 |
| 7 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
| 8 #include "ash/launcher/launcher_model.h" | 8 #include "ash/launcher/launcher_model.h" |
| 9 #include "ash/launcher/launcher_types.h" | 9 #include "ash/launcher/launcher_types.h" |
| 10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 class LauncherContextMenuTest : public ash::test::AshTestBase { | 34 class LauncherContextMenuTest : public ash::test::AshTestBase { |
| 35 protected: | 35 protected: |
| 36 static bool IsItemPresentInMenu(LauncherContextMenu* menu, int command_id) { | 36 static bool IsItemPresentInMenu(LauncherContextMenu* menu, int command_id) { |
| 37 DCHECK(menu); | 37 DCHECK(menu); |
| 38 return menu->GetIndexOfCommandId(command_id) != -1; | 38 return menu->GetIndexOfCommandId(command_id) != -1; |
| 39 } | 39 } |
| 40 | 40 |
| 41 LauncherContextMenuTest() | 41 LauncherContextMenuTest() |
| 42 : ash::test::AshTestBase(), | 42 : profile_(new TestingProfile()), |
| 43 profile_(new TestingProfile()), | |
| 44 browser_thread_(content::BrowserThread::UI, message_loop()) {} | 43 browser_thread_(content::BrowserThread::UI, message_loop()) {} |
| 45 | 44 |
| 46 virtual void SetUp() OVERRIDE { | 45 virtual void SetUp() OVERRIDE { |
| 47 ash::test::AshTestBase::SetUp(); | 46 ash::test::AshTestBase::SetUp(); |
| 48 controller_.reset( | 47 controller_.reset( |
| 49 new TestChromeLauncherControllerPerBrowser(profile(), | 48 new TestChromeLauncherControllerPerBrowser(profile(), |
| 50 &launcher_model_)); | 49 &launcher_model_)); |
| 51 } | 50 } |
| 52 | 51 |
| 53 virtual void TearDown() OVERRIDE { | 52 virtual void TearDown() OVERRIDE { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 EXPECT_TRUE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_NEW_WINDOW)); | 108 EXPECT_TRUE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_NEW_WINDOW)); |
| 110 | 109 |
| 111 // Disable Incognito mode. | 110 // Disable Incognito mode. |
| 112 IncognitoModePrefs::SetAvailability(profile()->GetPrefs(), | 111 IncognitoModePrefs::SetAvailability(profile()->GetPrefs(), |
| 113 IncognitoModePrefs::FORCED); | 112 IncognitoModePrefs::FORCED); |
| 114 menu.reset(CreateLauncherContextMenu(ash::TYPE_BROWSER_SHORTCUT)); | 113 menu.reset(CreateLauncherContextMenu(ash::TYPE_BROWSER_SHORTCUT)); |
| 115 ASSERT_TRUE(IsItemPresentInMenu( | 114 ASSERT_TRUE(IsItemPresentInMenu( |
| 116 menu.get(), LauncherContextMenu::MENU_NEW_WINDOW)); | 115 menu.get(), LauncherContextMenu::MENU_NEW_WINDOW)); |
| 117 EXPECT_FALSE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_NEW_WINDOW)); | 116 EXPECT_FALSE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_NEW_WINDOW)); |
| 118 } | 117 } |
| OLD | NEW |