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

Side by Side Diff: chrome/browser/chromeos/status/data_promo_notification_unittest.cc

Issue 2918203002: cros: Fix loading user profile w/o UserSessionManager (Closed)
Patch Set: rebase 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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/browser/chromeos/status/data_promo_notification.h" 5 #include "chrome/browser/chromeos/status/data_promo_notification.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" 10 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
11 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 11 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
12 #include "chrome/browser/chromeos/profiles/profile_helper.h"
12 #include "chrome/test/base/testing_browser_process.h" 13 #include "chrome/test/base/testing_browser_process.h"
13 #include "chrome/test/base/testing_profile_manager.h" 14 #include "chrome/test/base/testing_profile_manager.h"
14 #include "chromeos/chromeos_switches.h" 15 #include "chromeos/chromeos_switches.h"
15 #include "chromeos/dbus/dbus_thread_manager.h" 16 #include "chromeos/dbus/dbus_thread_manager.h"
16 #include "chromeos/dbus/shill_device_client.h" 17 #include "chromeos/dbus/shill_device_client.h"
17 #include "chromeos/dbus/shill_service_client.h" 18 #include "chromeos/dbus/shill_service_client.h"
18 #include "chromeos/login/login_state.h" 19 #include "chromeos/login/login_state.h"
19 #include "chromeos/network/network_connect.h" 20 #include "chromeos/network/network_connect.h"
20 #include "chromeos/network/network_state_handler.h" 21 #include "chromeos/network/network_state_handler.h"
21 #include "content/public/test/test_browser_thread_bundle.h" 22 #include "content/public/test/test_browser_thread_bundle.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 const AccountId test_account_id(AccountId::FromUserEmail(kTestUserName)); 97 const AccountId test_account_id(AccountId::FromUserEmail(kTestUserName));
97 user_manager->AddUser(test_account_id); 98 user_manager->AddUser(test_account_id);
98 user_manager->LoginUser(test_account_id); 99 user_manager->LoginUser(test_account_id);
99 user_manager_enabler_.reset( 100 user_manager_enabler_.reset(
100 new ScopedUserManagerEnabler(user_manager.release())); 101 new ScopedUserManagerEnabler(user_manager.release()));
101 102
102 profile_manager_.reset( 103 profile_manager_.reset(
103 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); 104 new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
104 ASSERT_TRUE(profile_manager_->SetUp()); 105 ASSERT_TRUE(profile_manager_->SetUp());
105 profile_manager_->SetLoggedIn(true); 106 profile_manager_->SetLoggedIn(true);
107
108 ProfileHelper::GetProfileByUserIdHashForTest(
109 ProfileHelper::GetUserIdHashByUserIdForTesting(
110 test_account_id.GetUserEmail()));
111
106 ASSERT_TRUE(user_manager::UserManager::Get()->GetPrimaryUser()); 112 ASSERT_TRUE(user_manager::UserManager::Get()->GetPrimaryUser());
107 113
108 LoginState::Initialize(); 114 LoginState::Initialize();
109 LoginState::Get()->SetLoggedInState(LoginState::LOGGED_IN_ACTIVE, 115 LoginState::Get()->SetLoggedInState(LoginState::LOGGED_IN_ACTIVE,
110 LoginState::LOGGED_IN_USER_REGULAR); 116 LoginState::LOGGED_IN_USER_REGULAR);
111 } 117 }
112 118
113 void SetupNetworkShillState() { 119 void SetupNetworkShillState() {
114 base::RunLoop().RunUntilIdle(); 120 base::RunLoop().RunUntilIdle();
115 121
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 164
159 chromeos::NetworkConnect::Get()->ConnectToNetworkId(kCellularGuid); 165 chromeos::NetworkConnect::Get()->ConnectToNetworkId(kCellularGuid);
160 base::RunLoop().RunUntilIdle(); 166 base::RunLoop().RunUntilIdle();
161 // Connecting to cellular network (which here makes it the default network) 167 // Connecting to cellular network (which here makes it the default network)
162 // should trigger the Data Saver notification. 168 // should trigger the Data Saver notification.
163 EXPECT_TRUE(message_center->FindVisibleNotificationById(kNotificationId)); 169 EXPECT_TRUE(message_center->FindVisibleNotificationById(kNotificationId));
164 } 170 }
165 171
166 } // namespace test 172 } // namespace test
167 } // namespace chromeos 173 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698