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

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

Issue 2459823002: [Sync] Rename syncable_prefs to sync_preferences. (Closed)
Patch Set: Created 4 years, 1 month 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 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/mac/scoped_nsobject.h" 9 #include "base/mac/scoped_nsobject.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "base/threading/thread_restrictions.h" 11 #include "base/threading/thread_restrictions.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/profiles/profile_attributes_entry.h" 13 #include "chrome/browser/profiles/profile_attributes_entry.h"
14 #include "chrome/browser/profiles/profile_attributes_storage.h" 14 #include "chrome/browser/profiles/profile_attributes_storage.h"
15 #include "chrome/browser/profiles/profile_manager.h" 15 #include "chrome/browser/profiles/profile_manager.h"
16 #include "chrome/browser/ui/browser_list.h" 16 #include "chrome/browser/ui/browser_list.h"
17 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" 17 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
18 #include "chrome/browser/ui/cocoa/run_loop_testing.h" 18 #include "chrome/browser/ui/cocoa/run_loop_testing.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "chrome/grit/generated_resources.h" 20 #include "chrome/grit/generated_resources.h"
21 #include "chrome/test/base/test_browser_window.h" 21 #include "chrome/test/base/test_browser_window.h"
22 #include "chrome/test/base/testing_profile.h" 22 #include "chrome/test/base/testing_profile.h"
23 #include "components/syncable_prefs/pref_service_syncable.h" 23 #include "components/sync_preferences/pref_service_syncable.h"
24 #include "testing/gtest_mac.h" 24 #include "testing/gtest_mac.h"
25 #include "ui/base/l10n/l10n_util_mac.h" 25 #include "ui/base/l10n/l10n_util_mac.h"
26 26
27 class ProfileMenuControllerTest : public CocoaProfileTest { 27 class ProfileMenuControllerTest : public CocoaProfileTest {
28 public: 28 public:
29 ProfileMenuControllerTest() { 29 ProfileMenuControllerTest() {
30 item_.reset([[NSMenuItem alloc] initWithTitle:@"Users" 30 item_.reset([[NSMenuItem alloc] initWithTitle:@"Users"
31 action:nil 31 action:nil
32 keyEquivalent:@""]); 32 keyEquivalent:@""]);
33 controller_.reset( 33 controller_.reset(
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // Simulate the active browser changing to NULL and ensure a profile doesn't 244 // Simulate the active browser changing to NULL and ensure a profile doesn't
245 // get created by disallowing IO operations temporarily. 245 // get created by disallowing IO operations temporarily.
246 const bool io_was_allowed = base::ThreadRestrictions::SetIOAllowed(false); 246 const bool io_was_allowed = base::ThreadRestrictions::SetIOAllowed(false);
247 [controller() activeBrowserChangedTo:NULL]; 247 [controller() activeBrowserChangedTo:NULL];
248 base::ThreadRestrictions::SetIOAllowed(io_was_allowed); 248 base::ThreadRestrictions::SetIOAllowed(io_was_allowed);
249 } 249 }
250 250
251 TEST_F(ProfileMenuControllerTest, SupervisedProfile) { 251 TEST_F(ProfileMenuControllerTest, SupervisedProfile) {
252 TestingProfileManager* manager = testing_profile_manager(); 252 TestingProfileManager* manager = testing_profile_manager();
253 TestingProfile* supervised_profile = manager->CreateTestingProfile( 253 TestingProfile* supervised_profile = manager->CreateTestingProfile(
254 "test1", std::unique_ptr<syncable_prefs::PrefServiceSyncable>(), 254 "test1", std::unique_ptr<sync_preferences::PrefServiceSyncable>(),
255 base::ASCIIToUTF16("Supervised User"), 0, "TEST_ID", 255 base::ASCIIToUTF16("Supervised User"), 0, "TEST_ID",
256 TestingProfile::TestingFactories()); 256 TestingProfile::TestingFactories());
257 // The supervised profile is initially marked as omitted from the avatar menu 257 // The supervised profile is initially marked as omitted from the avatar menu
258 // (in non-test code, until we have confirmation that it has actually been 258 // (in non-test code, until we have confirmation that it has actually been
259 // created on the server). For the test, just tell the profile attribute 259 // created on the server). For the test, just tell the profile attribute
260 // storage to un-hide it. 260 // storage to un-hide it.
261 ProfileAttributesEntry* entry; 261 ProfileAttributesEntry* entry;
262 ASSERT_TRUE(manager->profile_attributes_storage()-> 262 ASSERT_TRUE(manager->profile_attributes_storage()->
263 GetProfileAttributesWithPath(supervised_profile->GetPath(), &entry)); 263 GetProfileAttributesWithPath(supervised_profile->GetPath(), &entry));
264 entry->SetIsOmitted(false); 264 entry->SetIsOmitted(false);
(...skipping 27 matching lines...) Expand all
292 EXPECT_FALSE([controller() validateMenuItem:item]); 292 EXPECT_FALSE([controller() validateMenuItem:item]);
293 293
294 item = [menu itemAtIndex:1]; 294 item = [menu itemAtIndex:1];
295 ASSERT_EQ(@selector(switchToProfileFromMenu:), [item action]); 295 ASSERT_EQ(@selector(switchToProfileFromMenu:), [item action]);
296 EXPECT_TRUE([controller() validateMenuItem:item]); 296 EXPECT_TRUE([controller() validateMenuItem:item]);
297 297
298 item = [menu itemAtIndex:5]; 298 item = [menu itemAtIndex:5];
299 ASSERT_EQ(@selector(newProfile:), [item action]); 299 ASSERT_EQ(@selector(newProfile:), [item action]);
300 EXPECT_FALSE([controller() validateMenuItem:item]); 300 EXPECT_FALSE([controller() validateMenuItem:item]);
301 } 301 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698