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 "ash/test/test_session_state_delegate.h" | 5 #include "ash/test/test_session_state_delegate.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 TestSessionStateDelegate::~TestSessionStateDelegate() { | 40 TestSessionStateDelegate::~TestSessionStateDelegate() { |
41 } | 41 } |
42 | 42 |
43 content::BrowserContext* | 43 content::BrowserContext* |
44 TestSessionStateDelegate::GetBrowserContextByIndex( | 44 TestSessionStateDelegate::GetBrowserContextByIndex( |
45 MultiProfileIndex index) { | 45 MultiProfileIndex index) { |
46 return NULL; | 46 return NULL; |
47 } | 47 } |
48 | 48 |
| 49 content::BrowserContext* |
| 50 TestSessionStateDelegate::GetBrowserContextForWindow( |
| 51 aura::Window* window) { |
| 52 return NULL; |
| 53 } |
| 54 |
49 int TestSessionStateDelegate::GetMaximumNumberOfLoggedInUsers() const { | 55 int TestSessionStateDelegate::GetMaximumNumberOfLoggedInUsers() const { |
50 return 3; | 56 return 3; |
51 } | 57 } |
52 | 58 |
53 int TestSessionStateDelegate::NumberOfLoggedInUsers() const { | 59 int TestSessionStateDelegate::NumberOfLoggedInUsers() const { |
54 // TODO(skuhne): Add better test framework to test multiple profiles. | 60 // TODO(skuhne): Add better test framework to test multiple profiles. |
55 return has_active_user_ ? logged_in_users_ : 0; | 61 return has_active_user_ ? logged_in_users_ : 0; |
56 } | 62 } |
57 | 63 |
58 bool TestSessionStateDelegate::IsActiveUserSessionStarted() const { | 64 bool TestSessionStateDelegate::IsActiveUserSessionStarted() const { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 void TestSessionStateDelegate::SetShouldLockScreenBeforeSuspending( | 117 void TestSessionStateDelegate::SetShouldLockScreenBeforeSuspending( |
112 bool should_lock) { | 118 bool should_lock) { |
113 should_lock_screen_before_suspending_ = should_lock; | 119 should_lock_screen_before_suspending_ = should_lock; |
114 } | 120 } |
115 | 121 |
116 void TestSessionStateDelegate::SetUserAddingScreenRunning( | 122 void TestSessionStateDelegate::SetUserAddingScreenRunning( |
117 bool user_adding_screen_running) { | 123 bool user_adding_screen_running) { |
118 user_adding_screen_running_ = user_adding_screen_running; | 124 user_adding_screen_running_ = user_adding_screen_running; |
119 } | 125 } |
120 | 126 |
| 127 void TestSessionStateDelegate::SetUserImage( |
| 128 const gfx::ImageSkia& user_image) { |
| 129 user_image_ = user_image; |
| 130 } |
| 131 |
121 const base::string16 TestSessionStateDelegate::GetUserDisplayName( | 132 const base::string16 TestSessionStateDelegate::GetUserDisplayName( |
122 MultiProfileIndex index) const { | 133 MultiProfileIndex index) const { |
123 return base::UTF8ToUTF16("Über tray Über tray Über tray Über tray"); | 134 return base::UTF8ToUTF16("Über tray Über tray Über tray Über tray"); |
124 } | 135 } |
125 | 136 |
126 const std::string TestSessionStateDelegate::GetUserEmail( | 137 const std::string TestSessionStateDelegate::GetUserEmail( |
127 MultiProfileIndex index) const { | 138 MultiProfileIndex index) const { |
128 switch (index) { | 139 switch (index) { |
129 case 0: return "First@tray"; // This is intended to be capitalized. | 140 case 0: return "First@tray"; // This is intended to be capitalized. |
130 case 1: return "Second@tray"; // This is intended to be capitalized. | 141 case 1: return "Second@tray"; // This is intended to be capitalized. |
131 case 2: return "third@tray"; | 142 case 2: return "third@tray"; |
132 default: return "someone@tray"; | 143 default: return "someone@tray"; |
133 } | 144 } |
134 } | 145 } |
135 | 146 |
136 const std::string TestSessionStateDelegate::GetUserID( | 147 const std::string TestSessionStateDelegate::GetUserID( |
137 MultiProfileIndex index) const { | 148 MultiProfileIndex index) const { |
138 return GetUserIDFromEmail(GetUserEmail(index)); | 149 return GetUserIDFromEmail(GetUserEmail(index)); |
139 } | 150 } |
140 | 151 |
141 const gfx::ImageSkia& TestSessionStateDelegate::GetUserImage( | 152 const gfx::ImageSkia& TestSessionStateDelegate::GetUserImage( |
142 content::BrowserContext* context) const { | 153 content::BrowserContext* context) const { |
143 return null_image_; | 154 return user_image_; |
144 } | 155 } |
145 | 156 |
146 bool TestSessionStateDelegate::ShouldShowAvatar(aura::Window* window) { | 157 bool TestSessionStateDelegate::ShouldShowAvatar(aura::Window* window) { |
147 return false; | 158 return !user_image_.isNull(); |
148 } | 159 } |
149 | 160 |
150 void TestSessionStateDelegate::SwitchActiveUser(const std::string& user_id) { | 161 void TestSessionStateDelegate::SwitchActiveUser(const std::string& user_id) { |
151 // Make sure this is a user id and not an email address. | 162 // Make sure this is a user id and not an email address. |
152 EXPECT_EQ(user_id, GetUserIDFromEmail(user_id)); | 163 EXPECT_EQ(user_id, GetUserIDFromEmail(user_id)); |
153 activated_user_ = user_id; | 164 activated_user_ = user_id; |
154 } | 165 } |
155 | 166 |
156 void TestSessionStateDelegate::CycleActiveUser(CycleUser cycle_user) { | 167 void TestSessionStateDelegate::CycleActiveUser(CycleUser cycle_user) { |
157 activated_user_ = "someone@tray"; | 168 activated_user_ = "someone@tray"; |
158 } | 169 } |
159 | 170 |
160 void TestSessionStateDelegate::AddSessionStateObserver( | 171 void TestSessionStateDelegate::AddSessionStateObserver( |
161 SessionStateObserver* observer) { | 172 SessionStateObserver* observer) { |
162 } | 173 } |
163 | 174 |
164 void TestSessionStateDelegate::RemoveSessionStateObserver( | 175 void TestSessionStateDelegate::RemoveSessionStateObserver( |
165 SessionStateObserver* observer) { | 176 SessionStateObserver* observer) { |
166 } | 177 } |
167 | 178 |
168 } // namespace test | 179 } // namespace test |
169 } // namespace ash | 180 } // namespace ash |
OLD | NEW |