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

Side by Side Diff: chrome/browser/ui/ash/launcher/launcher_context_menu_unittest.cc

Issue 950053002: Cache the Windows Parental Controls Platform Answer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test Isolation Created 5 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
OLDNEW
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/shelf/shelf.h" 7 #include "ash/shelf/shelf.h"
8 #include "ash/shelf/shelf_item_types.h" 8 #include "ash/shelf/shelf_item_types.h"
9 #include "ash/shelf/shelf_model.h" 9 #include "ash/shelf/shelf_model.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 18 matching lines...) Expand all
29 class LauncherContextMenuTest : public ash::test::AshTestBase { 29 class LauncherContextMenuTest : public ash::test::AshTestBase {
30 protected: 30 protected:
31 static bool IsItemPresentInMenu(LauncherContextMenu* menu, int command_id) { 31 static bool IsItemPresentInMenu(LauncherContextMenu* menu, int command_id) {
32 DCHECK(menu); 32 DCHECK(menu);
33 return menu->GetIndexOfCommandId(command_id) != -1; 33 return menu->GetIndexOfCommandId(command_id) != -1;
34 } 34 }
35 35
36 LauncherContextMenuTest() 36 LauncherContextMenuTest()
37 : profile_(new TestingProfile()) {} 37 : profile_(new TestingProfile()) {}
38 38
39 static void SetUpTestCase() {
40 // Checking for incognito availability requires platform parental controls
41 // initialization.
42 IncognitoModePrefs::InitializePlatformParentalControls();
43 }
44
45 static void TearDownTestCase() {
46 IncognitoModePrefs::UninitializePlatformParentalControls();
47 }
48
39 void SetUp() override { 49 void SetUp() override {
40 ash::test::AshTestBase::SetUp(); 50 ash::test::AshTestBase::SetUp();
41 controller_.reset( 51 controller_.reset(
42 new TestChromeLauncherController(profile(), &shelf_model_)); 52 new TestChromeLauncherController(profile(), &shelf_model_));
43 } 53 }
44 54
45 void TearDown() override { 55 void TearDown() override {
46 controller_.reset(NULL); 56 controller_.reset(NULL);
47 ash::test::AshTestBase::TearDown(); 57 ash::test::AshTestBase::TearDown();
48 } 58 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 EXPECT_TRUE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_NEW_WINDOW)); 110 EXPECT_TRUE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_NEW_WINDOW));
101 111
102 // Disable Incognito mode. 112 // Disable Incognito mode.
103 IncognitoModePrefs::SetAvailability(profile()->GetPrefs(), 113 IncognitoModePrefs::SetAvailability(profile()->GetPrefs(),
104 IncognitoModePrefs::FORCED); 114 IncognitoModePrefs::FORCED);
105 menu.reset(CreateLauncherContextMenu(ash::TYPE_BROWSER_SHORTCUT)); 115 menu.reset(CreateLauncherContextMenu(ash::TYPE_BROWSER_SHORTCUT));
106 ASSERT_TRUE(IsItemPresentInMenu( 116 ASSERT_TRUE(IsItemPresentInMenu(
107 menu.get(), LauncherContextMenu::MENU_NEW_WINDOW)); 117 menu.get(), LauncherContextMenu::MENU_NEW_WINDOW));
108 EXPECT_FALSE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_NEW_WINDOW)); 118 EXPECT_FALSE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_NEW_WINDOW));
109 } 119 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698