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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/prefs/pref_registry_simple.h" 9 #include "base/prefs/pref_registry_simple.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "chrome/common/chrome_switches.h" 44 #include "chrome/common/chrome_switches.h"
45 #include "chrome/common/pref_names.h" 45 #include "chrome/common/pref_names.h"
46 #include "chrome/test/base/ui_test_utils.h" 46 #include "chrome/test/base/ui_test_utils.h"
47 #include "chromeos/audio/cras_audio_handler.h" 47 #include "chromeos/audio/cras_audio_handler.h"
48 #include "chromeos/chromeos_switches.h" 48 #include "chromeos/chromeos_switches.h"
49 #include "chromeos/chromeos_test_utils.h" 49 #include "chromeos/chromeos_test_utils.h"
50 #include "chromeos/dbus/dbus_thread_manager.h" 50 #include "chromeos/dbus/dbus_thread_manager.h"
51 #include "chromeos/dbus/fake_dbus_thread_manager.h" 51 #include "chromeos/dbus/fake_dbus_thread_manager.h"
52 #include "chromeos/dbus/fake_session_manager_client.h" 52 #include "chromeos/dbus/fake_session_manager_client.h"
53 #include "chromeos/network/network_state_handler.h" 53 #include "chromeos/network/network_state_handler.h"
54 #include "chromeos/system/mock_statistics_provider.h"
55 #include "chromeos/system/statistics_provider.h"
54 #include "content/public/test/browser_test_utils.h" 56 #include "content/public/test/browser_test_utils.h"
55 #include "content/public/test/test_utils.h" 57 #include "content/public/test/test_utils.h"
56 #include "grit/generated_resources.h" 58 #include "grit/generated_resources.h"
57 #include "net/test/spawned_test_server/spawned_test_server.h" 59 #include "net/test/spawned_test_server/spawned_test_server.h"
58 #include "testing/gmock/include/gmock/gmock.h" 60 #include "testing/gmock/include/gmock/gmock.h"
59 #include "testing/gtest/include/gtest/gtest.h" 61 #include "testing/gtest/include/gtest/gtest.h"
60 #include "third_party/icu/source/common/unicode/locid.h" 62 #include "third_party/icu/source/common/unicode/locid.h"
61 #include "ui/base/accelerators/accelerator.h" 63 #include "ui/base/accelerators/accelerator.h"
62 #include "ui/base/l10n/l10n_util.h" 64 #include "ui/base/l10n/l10n_util.h"
63 65
64 using ::testing::Exactly; 66 using ::testing::Exactly;
67 using ::testing::Invoke;
65 using ::testing::Return; 68 using ::testing::Return;
66 69
67 namespace chromeos { 70 namespace chromeos {
68 71
69 namespace { 72 namespace {
70 const char kUsername[] = "test_user@managedchrome.com"; 73 const char kUsername[] = "test_user@managedchrome.com";
71 const char kPassword[] = "test_password"; 74 const char kPassword[] = "test_password";
72 75
73 class PrefStoreStub : public TestingPrefStore { 76 class PrefStoreStub : public TestingPrefStore {
74 public: 77 public:
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 WrongHWIDScreen* screen = 510 WrongHWIDScreen* screen =
508 WizardController::default_controller()->GetWrongHWIDScreen(); 511 WizardController::default_controller()->GetWrongHWIDScreen();
509 EXPECT_EQ(screen, WizardController::default_controller()->current_screen()); 512 EXPECT_EQ(screen, WizardController::default_controller()->current_screen());
510 513
511 // After warning is skipped, user returns to sign-in screen. 514 // After warning is skipped, user returns to sign-in screen.
512 // And this destroys WizardController. 515 // And this destroys WizardController.
513 OnExit(ScreenObserver::WRONG_HWID_WARNING_SKIPPED); 516 OnExit(ScreenObserver::WRONG_HWID_WARNING_SKIPPED);
514 EXPECT_FALSE(ExistingUserController::current_controller() == NULL); 517 EXPECT_FALSE(ExistingUserController::current_controller() == NULL);
515 } 518 }
516 519
517 IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, 520 class WizardControllerEnrollmentFlowTest : public WizardControllerFlowTest {
521 protected:
522 WizardControllerEnrollmentFlowTest() {}
523
524 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
525 WizardControllerFlowTest::SetUpCommandLine(command_line);
526
527 command_line->AppendSwitch(
528 switches::kEnterpriseEnableForcedReEnrollment);
529 command_line->AppendSwitchASCII(
530 switches::kEnterpriseEnrollmentInitialModulus, "1");
531 command_line->AppendSwitchASCII(
532 switches::kEnterpriseEnrollmentModulusLimit, "2");
533 }
534
535 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.
536 WizardControllerFlowTest::SetUpInProcessBrowserTestFixture();
537 system::StatisticsProvider::SetTestProvider(&statistics_provider_);
538 EXPECT_CALL(statistics_provider_, StartLoadingMachineStatistics(_, _));
539 EXPECT_CALL(statistics_provider_, GetMachineStatistic(_, _)).WillRepeatedly(
540 Invoke(this, &WizardControllerEnrollmentFlowTest::GetMachineStatistic));
541 EXPECT_CALL(statistics_provider_, GetMachineFlag(_, _)).WillRepeatedly(
542 Return(false));
543 EXPECT_CALL(statistics_provider_, Shutdown());
544 }
545
546 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.
547 system::StatisticsProvider::SetTestProvider(NULL);
548 WizardControllerFlowTest::TearDownInProcessBrowserTestFixture();
549 }
550
551 bool GetMachineStatistic(const std::string& name, std::string* result) {
552 *result = "fake-" + name;
553 return true;
554 }
555
556 private:
557 system::MockStatisticsProvider statistics_provider_;
558
559 DISALLOW_COPY_AND_ASSIGN(WizardControllerEnrollmentFlowTest);
560 };
561
562 IN_PROC_BROWSER_TEST_F(WizardControllerEnrollmentFlowTest,
518 ControlFlowForcedReEnrollment) { 563 ControlFlowForcedReEnrollment) {
519 CommandLine::ForCurrentProcess()->AppendSwitch(
520 switches::kEnterpriseEnableForcedReEnrollment);
521 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
522 switches::kEnterpriseEnrollmentInitialModulus, "1");
523 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
524 switches::kEnterpriseEnrollmentModulusLimit, "2");
525
526 EXPECT_EQ(WizardController::default_controller()->GetNetworkScreen(), 564 EXPECT_EQ(WizardController::default_controller()->GetNetworkScreen(),
527 WizardController::default_controller()->current_screen()); 565 WizardController::default_controller()->current_screen());
528 EXPECT_CALL(*mock_network_screen_, Hide()).Times(1); 566 EXPECT_CALL(*mock_network_screen_, Hide()).Times(1);
529 EXPECT_CALL(*mock_eula_screen_, Show()).Times(1); 567 EXPECT_CALL(*mock_eula_screen_, Show()).Times(1);
530 OnExit(ScreenObserver::NETWORK_CONNECTED); 568 OnExit(ScreenObserver::NETWORK_CONNECTED);
531 569
532 EXPECT_EQ(WizardController::default_controller()->GetEulaScreen(), 570 EXPECT_EQ(WizardController::default_controller()->GetEulaScreen(),
533 WizardController::default_controller()->current_screen()); 571 WizardController::default_controller()->current_screen());
534 EXPECT_CALL(*mock_eula_screen_, Hide()).Times(1); 572 EXPECT_CALL(*mock_eula_screen_, Hide()).Times(1);
535 EXPECT_CALL(*mock_update_screen_, StartNetworkCheck()).Times(1); 573 EXPECT_CALL(*mock_update_screen_, StartNetworkCheck()).Times(1);
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 } 869 }
832 870
833 // TODO(dzhioev): Add test emaulating device with wrong HWID. 871 // TODO(dzhioev): Add test emaulating device with wrong HWID.
834 872
835 // TODO(nkostylev): Add test for WebUI accelerators http://crosbug.com/22571 873 // TODO(nkostylev): Add test for WebUI accelerators http://crosbug.com/22571
836 874
837 COMPILE_ASSERT(ScreenObserver::EXIT_CODES_COUNT == 20, 875 COMPILE_ASSERT(ScreenObserver::EXIT_CODES_COUNT == 20,
838 add_tests_for_new_control_flow_you_just_introduced); 876 add_tests_for_new_control_flow_you_just_introduced);
839 877
840 } // namespace chromeos 878 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698