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

Unified Diff: chrome/browser/chromeos/system/tray_accessibility_browsertest.cc

Issue 2942043002: cros: Tighten profile loading (Closed)
Patch Set: update SystemClock header Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/system/system_clock.cc ('k') | chrome/browser/profiles/profile_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/system/tray_accessibility_browsertest.cc
diff --git a/chrome/browser/chromeos/system/tray_accessibility_browsertest.cc b/chrome/browser/chromeos/system/tray_accessibility_browsertest.cc
index 03258495ee0bc006418d50e521ec1736f6e4d6d6..9e5689138f78dff628f40e1fd526f727cc9093de 100644
--- a/chrome/browser/chromeos/system/tray_accessibility_browsertest.cc
+++ b/chrome/browser/chromeos/system/tray_accessibility_browsertest.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/chromeos/accessibility/magnification_manager.h"
#include "chrome/browser/chromeos/login/helper.h"
#include "chrome/browser/chromeos/login/startup_utils.h"
+#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/extensions/api/braille_display_private/mock_braille_controller.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -64,6 +65,18 @@ void SetMagnifierEnabled(bool enabled) {
MagnificationManager::Get()->SetMagnifierEnabled(enabled);
}
+// Simulates how UserSessionManager creates and starts a user session.
+void CreateAndStartUserSession(const AccountId& account_id) {
+ using session_manager::SessionManager;
+
+ const std::string user_id_hash =
+ ProfileHelper::GetUserIdHashByUserIdForTesting(account_id.GetUserEmail());
+
+ SessionManager::Get()->CreateSession(account_id, user_id_hash);
+ ProfileHelper::GetProfileByUserIdHashForTest(user_id_hash);
+ SessionManager::Get()->SessionStarted();
+}
+
class TrayAccessibilityTest
: public InProcessBrowserTest,
public WithParamInterface<PrefSettingMechanism> {
@@ -352,9 +365,7 @@ class TrayAccessibilityTest
IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, LoginStatus) {
EXPECT_EQ(ash::LoginStatus::NOT_LOGGED_IN, GetLoginStatus());
- session_manager::SessionManager::Get()->CreateSession(
- AccountId::FromUserEmail("owner@invalid.domain"), "owner@invalid.domain");
- session_manager::SessionManager::Get()->SessionStarted();
+ CreateAndStartUserSession(AccountId::FromUserEmail("owner@invalid.domain"));
// Flush to ensure the session state reaches ash and updates login status.
SessionControllerClient::FlushForTesting();
@@ -367,9 +378,7 @@ IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowTrayIcon) {
// Confirms that the icon is invisible before login.
EXPECT_FALSE(IsTrayIconVisible());
- session_manager::SessionManager::Get()->CreateSession(
- AccountId::FromUserEmail("owner@invalid.domain"), "owner@invalid.domain");
- session_manager::SessionManager::Get()->SessionStarted();
+ CreateAndStartUserSession(AccountId::FromUserEmail("owner@invalid.domain"));
// Confirms that the icon is invisible just after login.
EXPECT_FALSE(IsTrayIconVisible());
@@ -508,9 +517,7 @@ IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowTrayIcon) {
IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenu) {
// Login
- session_manager::SessionManager::Get()->CreateSession(
- AccountId::FromUserEmail("owner@invalid.domain"), "owner@invalid.domain");
- session_manager::SessionManager::Get()->SessionStarted();
+ CreateAndStartUserSession(AccountId::FromUserEmail("owner@invalid.domain"));
// Flush to ensure the session state reaches ash and updates login status.
SessionControllerClient::FlushForTesting();
@@ -648,9 +655,7 @@ IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenu) {
IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowMenuOption) {
// Login
- session_manager::SessionManager::Get()->CreateSession(
- AccountId::FromUserEmail("owner@invalid.domain"), "owner@invalid.domain");
- session_manager::SessionManager::Get()->SessionStarted();
+ CreateAndStartUserSession(AccountId::FromUserEmail("owner@invalid.domain"));
// Flush to ensure the session state reaches ash and updates login status.
SessionControllerClient::FlushForTesting();
@@ -1639,9 +1644,7 @@ IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, CheckMenuVisibilityOnDetailMenu) {
CloseDetailMenu();
// Simulate login.
- session_manager::SessionManager::Get()->CreateSession(
- AccountId::FromUserEmail("owner@invalid.domain"), "owner@invalid.domain");
- session_manager::SessionManager::Get()->SessionStarted();
+ CreateAndStartUserSession(AccountId::FromUserEmail("owner@invalid.domain"));
// Flush to ensure the session state reaches ash and updates login status.
SessionControllerClient::FlushForTesting();
EXPECT_TRUE(CreateDetailedMenu());
« no previous file with comments | « chrome/browser/chromeos/system/system_clock.cc ('k') | chrome/browser/profiles/profile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698