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

Side by Side Diff: chrome/browser/ui/cocoa/profiles/profile_menu_controller_unittest.mm

Issue 384023002: Rename "managed (mode|user)" to "supervised user" (part 6) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: break long lines Created 6 years, 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #import "chrome/browser/ui/cocoa/profiles/profile_menu_controller.h" 5 #import "chrome/browser/ui/cocoa/profiles/profile_menu_controller.h"
6 6
7 #include "base/mac/scoped_nsobject.h" 7 #include "base/mac/scoped_nsobject.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/threading/thread_restrictions.h" 9 #include "base/threading/thread_restrictions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 local_state->SetString(prefs::kProfileLastUsed, 237 local_state->SetString(prefs::kProfileLastUsed,
238 profile3_path.BaseName().MaybeAsASCII()); 238 profile3_path.BaseName().MaybeAsASCII());
239 239
240 // Simulate the active browser changing to NULL and ensure a profile doesn't 240 // Simulate the active browser changing to NULL and ensure a profile doesn't
241 // get created by disallowing IO operations temporarily. 241 // get created by disallowing IO operations temporarily.
242 const bool io_was_allowed = base::ThreadRestrictions::SetIOAllowed(false); 242 const bool io_was_allowed = base::ThreadRestrictions::SetIOAllowed(false);
243 [controller() activeBrowserChangedTo:NULL]; 243 [controller() activeBrowserChangedTo:NULL];
244 base::ThreadRestrictions::SetIOAllowed(io_was_allowed); 244 base::ThreadRestrictions::SetIOAllowed(io_was_allowed);
245 } 245 }
246 246
247 TEST_F(ProfileMenuControllerTest, ManagedProfile) { 247 TEST_F(ProfileMenuControllerTest, SupervisedProfile) {
248 TestingProfileManager* manager = testing_profile_manager(); 248 TestingProfileManager* manager = testing_profile_manager();
249 TestingProfile* managed_profile = 249 TestingProfile* supervised_profile =
250 manager->CreateTestingProfile("test1", 250 manager->CreateTestingProfile("test1",
251 scoped_ptr<PrefServiceSyncable>(), 251 scoped_ptr<PrefServiceSyncable>(),
252 base::ASCIIToUTF16("Supervised User"), 252 base::ASCIIToUTF16("Supervised User"),
253 0, 253 0,
254 "TEST_ID", 254 "TEST_ID",
255 TestingProfile::TestingFactories()); 255 TestingProfile::TestingFactories());
256 BrowserList::SetLastActive(browser()); 256 BrowserList::SetLastActive(browser());
257 257
258 NSMenu* menu = [controller() menu]; 258 NSMenu* menu = [controller() menu];
259 ASSERT_EQ(6, [menu numberOfItems]); 259 ASSERT_EQ(6, [menu numberOfItems]);
260 NSMenuItem* item = [menu itemAtIndex:0]; 260 NSMenuItem* item = [menu itemAtIndex:0];
261 ASSERT_EQ(@selector(switchToProfileFromMenu:), [item action]); 261 ASSERT_EQ(@selector(switchToProfileFromMenu:), [item action]);
262 EXPECT_TRUE([controller() validateMenuItem:item]); 262 EXPECT_TRUE([controller() validateMenuItem:item]);
263 263
264 item = [menu itemAtIndex:1]; 264 item = [menu itemAtIndex:1];
265 ASSERT_EQ(@selector(switchToProfileFromMenu:), [item action]); 265 ASSERT_EQ(@selector(switchToProfileFromMenu:), [item action]);
266 EXPECT_TRUE([controller() validateMenuItem:item]); 266 EXPECT_TRUE([controller() validateMenuItem:item]);
267 267
268 item = [menu itemAtIndex:5]; 268 item = [menu itemAtIndex:5];
269 ASSERT_EQ(@selector(newProfile:), [item action]); 269 ASSERT_EQ(@selector(newProfile:), [item action]);
270 EXPECT_TRUE([controller() validateMenuItem:item]); 270 EXPECT_TRUE([controller() validateMenuItem:item]);
271 271
272 // Open a new browser for the managed user and switch to it. 272 // Open a new browser for the supervised user and switch to it.
273 Browser::CreateParams managed_profile_params( 273 Browser::CreateParams supervised_profile_params(
274 managed_profile, chrome::HOST_DESKTOP_TYPE_NATIVE); 274 supervised_profile, chrome::HOST_DESKTOP_TYPE_NATIVE);
275 scoped_ptr<Browser> managed_browser( 275 scoped_ptr<Browser> supervised_browser(
276 chrome::CreateBrowserWithTestWindowForParams(&managed_profile_params)); 276 chrome::CreateBrowserWithTestWindowForParams(&supervised_profile_params));
277 BrowserList::SetLastActive(managed_browser.get()); 277 BrowserList::SetLastActive(supervised_browser.get());
278 278
279 item = [menu itemAtIndex:0]; 279 item = [menu itemAtIndex:0];
280 ASSERT_EQ(@selector(switchToProfileFromMenu:), [item action]); 280 ASSERT_EQ(@selector(switchToProfileFromMenu:), [item action]);
281 EXPECT_FALSE([controller() validateMenuItem:item]); 281 EXPECT_FALSE([controller() validateMenuItem:item]);
282 282
283 item = [menu itemAtIndex:1]; 283 item = [menu itemAtIndex:1];
284 ASSERT_EQ(@selector(switchToProfileFromMenu:), [item action]); 284 ASSERT_EQ(@selector(switchToProfileFromMenu:), [item action]);
285 EXPECT_TRUE([controller() validateMenuItem:item]); 285 EXPECT_TRUE([controller() validateMenuItem:item]);
286 286
287 item = [menu itemAtIndex:5]; 287 item = [menu itemAtIndex:5];
288 ASSERT_EQ(@selector(newProfile:), [item action]); 288 ASSERT_EQ(@selector(newProfile:), [item action]);
289 EXPECT_FALSE([controller() validateMenuItem:item]); 289 EXPECT_FALSE([controller() validateMenuItem:item]);
290 } 290 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698