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

Unified Diff: chrome/browser/chromeos/login/wizard_controller_browsertest.cc

Issue 212653004: Update server-backed state key generation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make state keys time-dependent. Created 6 years, 9 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/login/wizard_controller_browsertest.cc
diff --git a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
index 49ffcfd92429b1d2d69cde2618e1100f41c7d0a4..8a8f171bdc61021892920f673b77ffba4b80accf 100644
--- a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
+++ b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
@@ -51,6 +51,8 @@
#include "chromeos/dbus/fake_dbus_thread_manager.h"
#include "chromeos/dbus/fake_session_manager_client.h"
#include "chromeos/network/network_state_handler.h"
+#include "chromeos/system/mock_statistics_provider.h"
+#include "chromeos/system/statistics_provider.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "grit/generated_resources.h"
@@ -62,6 +64,7 @@
#include "ui/base/l10n/l10n_util.h"
using ::testing::Exactly;
+using ::testing::Invoke;
using ::testing::Return;
namespace chromeos {
@@ -514,15 +517,50 @@ IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest,
EXPECT_FALSE(ExistingUserController::current_controller() == NULL);
}
-IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest,
- ControlFlowForcedReEnrollment) {
- CommandLine::ForCurrentProcess()->AppendSwitch(
- switches::kEnterpriseEnableForcedReEnrollment);
- CommandLine::ForCurrentProcess()->AppendSwitchASCII(
- switches::kEnterpriseEnrollmentInitialModulus, "1");
- CommandLine::ForCurrentProcess()->AppendSwitchASCII(
- switches::kEnterpriseEnrollmentModulusLimit, "2");
+class WizardControllerEnrollmentFlowTest : public WizardControllerFlowTest {
+ protected:
+ WizardControllerEnrollmentFlowTest() {}
+
+ virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
+ WizardControllerFlowTest::SetUpCommandLine(command_line);
+
+ command_line->AppendSwitch(
+ switches::kEnterpriseEnableForcedReEnrollment);
+ command_line->AppendSwitchASCII(
+ switches::kEnterpriseEnrollmentInitialModulus, "1");
+ command_line->AppendSwitchASCII(
+ switches::kEnterpriseEnrollmentModulusLimit, "2");
+ }
+
+ virtual void SetUpInProcessBrowserTestFixture() {
Joao da Silva 2014/03/27 15:45:40 OVERRIDE
Mattias Nissler (ping if slow) 2014/03/27 16:12:41 Done.
+ WizardControllerFlowTest::SetUpInProcessBrowserTestFixture();
+ system::StatisticsProvider::SetTestProvider(&statistics_provider_);
+ EXPECT_CALL(statistics_provider_, StartLoadingMachineStatistics(_, _));
+ EXPECT_CALL(statistics_provider_, GetMachineStatistic(_, _)).WillRepeatedly(
+ Invoke(this, &WizardControllerEnrollmentFlowTest::GetMachineStatistic));
+ EXPECT_CALL(statistics_provider_, GetMachineFlag(_, _)).WillRepeatedly(
+ Return(false));
+ EXPECT_CALL(statistics_provider_, Shutdown());
+ }
+
+ virtual void TearDownInProcessBrowserTestFixture() {
Joao da Silva 2014/03/27 15:45:40 OVERRIDE
Mattias Nissler (ping if slow) 2014/03/27 16:12:41 Done.
+ system::StatisticsProvider::SetTestProvider(NULL);
+ WizardControllerFlowTest::TearDownInProcessBrowserTestFixture();
+ }
+ bool GetMachineStatistic(const std::string& name, std::string* result) {
+ *result = "fake-" + name;
+ return true;
+ }
+
+ private:
+ system::MockStatisticsProvider statistics_provider_;
+
+ DISALLOW_COPY_AND_ASSIGN(WizardControllerEnrollmentFlowTest);
+};
+
+IN_PROC_BROWSER_TEST_F(WizardControllerEnrollmentFlowTest,
+ ControlFlowForcedReEnrollment) {
EXPECT_EQ(WizardController::default_controller()->GetNetworkScreen(),
WizardController::default_controller()->current_screen());
EXPECT_CALL(*mock_network_screen_, Hide()).Times(1);

Powered by Google App Engine
This is Rietveld 408576698