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

Side by Side Diff: chrome/test/base/testing_profile_manager.cc

Issue 18153007: Add policies to control power management on the Chrome OS login screen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Correct example in policy_templates.json. Created 7 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 (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/test/base/testing_profile_manager.h" 5 #include "chrome/test/base/testing_profile_manager.h"
6 6
7 #include "base/files/file_path.h"
8 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
9 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/extensions/extension_special_storage_policy.h" 9 #include "chrome/browser/extensions/extension_special_storage_policy.h"
11 #include "chrome/browser/prefs/pref_service_syncable.h" 10 #include "chrome/browser/prefs/pref_service_syncable.h"
12 #include "chrome/browser/profiles/profile_info_cache.h" 11 #include "chrome/browser/profiles/profile_info_cache.h"
13 #include "chrome/browser/profiles/profile_manager.h" 12 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/test/base/testing_browser_process.h" 13 #include "chrome/test/base/testing_browser_process.h"
15 #include "chrome/test/base/testing_profile.h" 14 #include "chrome/test/base/testing_profile.h"
16 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
17 16
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 96 }
98 97
99 void TestingProfileManager::DeleteProfileInfoCache() { 98 void TestingProfileManager::DeleteProfileInfoCache() {
100 profile_manager_->profile_info_cache_.reset(NULL); 99 profile_manager_->profile_info_cache_.reset(NULL);
101 } 100 }
102 101
103 void TestingProfileManager::SetLoggedIn(bool logged_in) { 102 void TestingProfileManager::SetLoggedIn(bool logged_in) {
104 profile_manager_->logged_in_ = logged_in; 103 profile_manager_->logged_in_ = logged_in;
105 } 104 }
106 105
106 const base::FilePath& TestingProfileManager::profiles_dir() {
107 DCHECK(called_set_up_);
108 return profiles_dir_.path();
109 }
110
107 ProfileManager* TestingProfileManager::profile_manager() { 111 ProfileManager* TestingProfileManager::profile_manager() {
108 DCHECK(called_set_up_); 112 DCHECK(called_set_up_);
109 return profile_manager_; 113 return profile_manager_;
110 } 114 }
111 115
112 ProfileInfoCache* TestingProfileManager::profile_info_cache() { 116 ProfileInfoCache* TestingProfileManager::profile_info_cache() {
113 DCHECK(called_set_up_); 117 DCHECK(called_set_up_);
114 return &profile_manager_->GetProfileInfoCache(); 118 return &profile_manager_->GetProfileInfoCache();
115 } 119 }
116 120
117 void TestingProfileManager::SetUpInternal() { 121 void TestingProfileManager::SetUpInternal() {
118 ASSERT_FALSE(browser_process_->profile_manager()) 122 ASSERT_FALSE(browser_process_->profile_manager())
119 << "ProfileManager already exists"; 123 << "ProfileManager already exists";
120 124
121 // Set up the directory for profiles. 125 // Set up the directory for profiles.
122 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); 126 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir());
123 127
124 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); 128 profile_manager_ = new testing::ProfileManager(profiles_dir_.path());
125 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. 129 browser_process_->SetProfileManager(profile_manager_); // Takes ownership.
126 130
127 called_set_up_ = true; 131 called_set_up_ = true;
128 } 132 }
OLDNEW
« no previous file with comments | « chrome/test/base/testing_profile_manager.h ('k') | chrome/test/data/policy/policy_test_cases.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698