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

Unified Diff: chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_browsertest.cc

Issue 1737453003: Revert of Reland: No longer start up profile if there was an error fetching policy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
Index: chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_browsertest.cc
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_browsertest.cc b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_browsertest.cc
index f8d91e76d8488c038df0eab4d3a925e1481e09e9..6ae59a61a63b4bb0f446e0799e555323ec5d993e 100644
--- a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_browsertest.cc
+++ b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_browsertest.cc
@@ -7,54 +7,14 @@
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
-#include "base/run_loop.h"
#include "base/values.h"
-#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/chromeos/login/ui/webui_login_display.h"
#include "chrome/browser/chromeos/policy/login_policy_test_base.h"
-#include "chrome/browser/chromeos/policy/user_policy_test_helper.h"
#include "chrome/browser/prefs/session_startup_pref.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
-#include "components/user_manager/user.h"
-#include "components/user_manager/user_manager.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
-#include "content/public/browser/notification_service.h"
#include "policy/policy_constants.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace {
-// Helper class that counts the number of notifications of the specified
-// type that have been received.
-class CountNotificationObserver : public content::NotificationObserver {
- public:
- CountNotificationObserver(int notification_type_to_count,
- const content::NotificationSource& source)
- : notification_count_(0) {
- registrar_.Add(this, notification_type_to_count, source);
- }
-
- // NotificationObserver:
- void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) override {
- // Count the number of notifications seen.
- notification_count_++;
- }
-
- int notification_count() const { return notification_count_; }
-
- private:
- int notification_count_;
- content::NotificationRegistrar registrar_;
-
- DISALLOW_COPY_AND_ASSIGN(CountNotificationObserver);
-};
-
-} // namespace
namespace policy {
@@ -82,12 +42,6 @@
SkipToLoginScreen();
LogIn(kAccountId, kAccountPassword);
- // User should be marked as having a valid OAuth token.
- const user_manager::UserManager* const user_manager =
- user_manager::UserManager::Get();
- EXPECT_EQ(user_manager::User::OAUTH2_TOKEN_STATUS_VALID,
- user_manager->GetActiveUser()->oauth_token_status());
-
// Check that the startup pages specified in policy were opened.
BrowserList* browser_list = BrowserList::GetInstance();
EXPECT_EQ(1U, browser_list->size());
@@ -104,24 +58,4 @@
}
}
-IN_PROC_BROWSER_TEST_F(UserCloudPolicyManagerTest, ErrorLoadingPolicy) {
- // Delete the policy file - this will cause a 500 error on policy requests.
- user_policy_helper()->DeletePolicyFile();
- SkipToLoginScreen();
- CountNotificationObserver observer(
- chrome::NOTIFICATION_SESSION_STARTED,
- content::NotificationService::AllSources());
- GetLoginDisplay()->ShowSigninScreenForCreds(kAccountId, kAccountPassword);
- base::RunLoop().Run();
- // Should not receive a SESSION_STARTED notification.
- ASSERT_EQ(0, observer.notification_count());
-
- // User should not be marked as having a valid OAuth token. That way, if we
- // try to load the user in the future, we will attempt to load policy again.
- const user_manager::UserManager* user_manager =
- user_manager::UserManager::Get();
- EXPECT_NE(user_manager::User::OAUTH2_TOKEN_STATUS_VALID,
- user_manager->GetActiveUser()->oauth_token_status());
-}
-
} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698