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

Side by Side Diff: chrome/browser/chromeos/login/enrollment/enrollment_screen_unittest.cc

Issue 2700303002: cros: Unify oobe View/Actor naming to just View. (Closed)
Patch Set: Rebase Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2017 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/login/enrollment/enrollment_screen.h" 5 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/test/scoped_mock_time_message_loop_task_runner.h" 10 #include "base/test/scoped_mock_time_message_loop_task_runner.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 policy::EnrollmentStatus::ForStatus( 70 policy::EnrollmentStatus::ForStatus(
71 policy::EnrollmentStatus::REGISTRATION_FAILED)); 71 policy::EnrollmentStatus::REGISTRATION_FAILED));
72 })); 72 }));
73 } 73 }
74 return mock; 74 return mock;
75 } 75 }
76 76
77 // Creates the EnrollmentScreen and sets required parameters. 77 // Creates the EnrollmentScreen and sets required parameters.
78 void SetUpEnrollmentScreen() { 78 void SetUpEnrollmentScreen() {
79 enrollment_screen_.reset( 79 enrollment_screen_.reset(
80 new EnrollmentScreen(&mock_delegate_, &mock_actor_)); 80 new EnrollmentScreen(&mock_delegate_, &mock_view_));
81 enrollment_screen_->SetParameters(enrollment_config_, &fake_controller_); 81 enrollment_screen_->SetParameters(enrollment_config_, &fake_controller_);
82 } 82 }
83 83
84 // Fast forwards time by the specified amount. 84 // Fast forwards time by the specified amount.
85 void FastForwardTime(base::TimeDelta time) { 85 void FastForwardTime(base::TimeDelta time) {
86 runner_.task_runner()->FastForwardBy(time); 86 runner_.task_runner()->FastForwardBy(time);
87 } 87 }
88 88
89 MockBaseScreenDelegate* GetBaseScreenDelegate() { return &mock_delegate_; } 89 MockBaseScreenDelegate* GetBaseScreenDelegate() { return &mock_delegate_; }
90 90
(...skipping 18 matching lines...) Expand all
109 109
110 private: 110 private:
111 // Replace main thread's task runner with a mock for duration of test. 111 // Replace main thread's task runner with a mock for duration of test.
112 base::MessageLoop loop_; 112 base::MessageLoop loop_;
113 base::ScopedMockTimeMessageLoopTaskRunner runner_; 113 base::ScopedMockTimeMessageLoopTaskRunner runner_;
114 114
115 // Objects required by the EnrollmentScreen that can be re-used. 115 // Objects required by the EnrollmentScreen that can be re-used.
116 policy::EnrollmentConfig enrollment_config_; 116 policy::EnrollmentConfig enrollment_config_;
117 pairing_chromeos::FakeControllerPairingController fake_controller_; 117 pairing_chromeos::FakeControllerPairingController fake_controller_;
118 MockBaseScreenDelegate mock_delegate_; 118 MockBaseScreenDelegate mock_delegate_;
119 MockEnrollmentScreenActor mock_actor_; 119 MockEnrollmentScreenView mock_view_;
120 120
121 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreenUnitTest); 121 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreenUnitTest);
122 }; 122 };
123 123
124 TEST_F(EnrollmentScreenUnitTest, Retries) { 124 TEST_F(EnrollmentScreenUnitTest, Retries) {
125 // Define behavior of EnterpriseEnrollmentHelperMock to always fail 125 // Define behavior of EnterpriseEnrollmentHelperMock to always fail
126 // enrollment. 126 // enrollment.
127 EnterpriseEnrollmentHelper::SetupEnrollmentHelperMock( 127 EnterpriseEnrollmentHelper::SetupEnrollmentHelperMock(
128 &EnrollmentScreenUnitTest::MockEnrollmentHelperCreator<false>); 128 &EnrollmentScreenUnitTest::MockEnrollmentHelperCreator<false>);
129 129
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 // This is how we check that the code finishes and cleanly exits 198 // This is how we check that the code finishes and cleanly exits
199 // the enterprise enrollment flow. 199 // the enterprise enrollment flow.
200 EXPECT_CALL(*GetBaseScreenDelegate(), 200 EXPECT_CALL(*GetBaseScreenDelegate(),
201 OnExit(_, BaseScreenDelegate::ENTERPRISE_ENROLLMENT_COMPLETED, _)) 201 OnExit(_, BaseScreenDelegate::ENTERPRISE_ENROLLMENT_COMPLETED, _))
202 .Times(1); 202 .Times(1);
203 203
204 // Start zero-touch enrollment. 204 // Start zero-touch enrollment.
205 enrollment_screen_->Show(); 205 enrollment_screen_->Show();
206 } 206 }
207 } // namespace chromeos 207 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698