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

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

Issue 1083683003: Speculative revert by sheriff (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed an unrelated commit that had accidentally slipped in. Created 5 years, 8 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/blocking_login_browsertest.cc
diff --git a/chrome/browser/chromeos/policy/blocking_login_browsertest.cc b/chrome/browser/chromeos/policy/blocking_login_browsertest.cc
index 03b0504c4681d7b21f4a5e7e318b2a092de7be8c..dabc1f7acffcb24e4f000deab10a6052e837bf63 100644
--- a/chrome/browser/chromeos/policy/blocking_login_browsertest.cc
+++ b/chrome/browser/chromeos/policy/blocking_login_browsertest.cc
@@ -12,7 +12,6 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/login/existing_user_controller.h"
-#include "chrome/browser/chromeos/login/test/oobe_base_test.h"
#include "chrome/browser/chromeos/login/ui/webui_login_display.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
@@ -28,6 +27,7 @@
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_service.h"
#include "content/public/test/test_utils.h"
+#include "google_apis/gaia/fake_gaia.h"
#include "google_apis/gaia/gaia_switches.h"
#include "google_apis/gaia/gaia_urls.h"
#include "net/http/http_status_code.h"
@@ -81,35 +81,52 @@ struct BlockingLoginTestParam {
};
class BlockingLoginTest
- : public OobeBaseTest,
+ : public InProcessBrowserTest,
public content::NotificationObserver,
public testing::WithParamInterface<BlockingLoginTestParam> {
public:
BlockingLoginTest() : profile_added_(NULL) {}
void SetUpCommandLine(base::CommandLine* command_line) override {
- OobeBaseTest::SetUpCommandLine(command_line);
-
+ // Initialize the test server early, so that we can use its base url for
+ // the command line flags.
+ ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+
+ // Use the login manager screens and the gaia auth extension.
+ command_line->AppendSwitch(switches::kLoginManager);
+ command_line->AppendSwitch(switches::kForceLoginManagerInTests);
+ command_line->AppendSwitchASCII(switches::kLoginProfile, "user");
command_line->AppendSwitchASCII(::switches::kAuthExtensionPath,
"gaia_auth");
+
+ // Redirect requests to gaia and the policy server to the test server.
+ command_line->AppendSwitchASCII(::switches::kGaiaUrl,
+ embedded_test_server()->base_url().spec());
+ command_line->AppendSwitchASCII(::switches::kLsoUrl,
+ embedded_test_server()->base_url().spec());
command_line->AppendSwitchASCII(
policy::switches::kDeviceManagementUrl,
embedded_test_server()->GetURL("/device_management").spec());
}
void SetUpOnMainThread() override {
+ fake_gaia_.Initialize();
+
+ embedded_test_server()->RegisterRequestHandler(
+ base::Bind(&BlockingLoginTest::HandleRequest, base::Unretained(this)));
+ embedded_test_server()->RegisterRequestHandler(
+ base::Bind(&FakeGaia::HandleRequest, base::Unretained(&fake_gaia_)));
+
registrar_.Add(this,
chrome::NOTIFICATION_PROFILE_ADDED,
content::NotificationService::AllSources());
-
- OobeBaseTest::SetUpOnMainThread();
}
void TearDownOnMainThread() override {
RunUntilIdle();
EXPECT_TRUE(responses_.empty());
STLDeleteElements(&responses_);
- OobeBaseTest::TearDownOnMainThread();
+ EXPECT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete());
}
void Observe(int type,
@@ -228,14 +245,10 @@ class BlockingLoginTest
}
protected:
- void RegisterAdditionalRequestHandlers() override {
- embedded_test_server()->RegisterRequestHandler(
- base::Bind(&BlockingLoginTest::HandleRequest, base::Unretained(this)));
- }
-
Profile* profile_added_;
private:
+ FakeGaia fake_gaia_;
std::vector<net::test_server::HttpResponse*> responses_;
content::NotificationRegistrar registrar_;
« no previous file with comments | « chrome/browser/chromeos/login/wizard_controller_browsertest.cc ('k') | chrome/browser/resources/extensions/extension_list.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698