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

Side by Side Diff: chrome/browser/chromeos/login/screens/network_screen_browsertest.cc

Issue 2526423002: Fixed flaky test (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/chromeos/login/screens/network_screen.h" 5 #include "chrome/browser/chromeos/login/screens/network_screen.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 private: 161 private:
162 // Overridden from InProcessBrowserTest: 162 // Overridden from InProcessBrowserTest:
163 void SetUpCommandLine(base::CommandLine* command_line) override { 163 void SetUpCommandLine(base::CommandLine* command_line) override {
164 command_line->AppendSwitchASCII( 164 command_line->AppendSwitchASCII(
165 switches::kEnterpriseEnableZeroTouchEnrollment, "hands-off"); 165 switches::kEnterpriseEnableZeroTouchEnrollment, "hands-off");
166 } 166 }
167 167
168 DISALLOW_COPY_AND_ASSIGN(HandsOffNetworkScreenTest); 168 DISALLOW_COPY_AND_ASSIGN(HandsOffNetworkScreenTest);
169 }; 169 };
170 170
171 #if defined(OS_CHROMEOS) 171 //#if defined(OS_CHROMEOS)
172 #define MAYBE_RequiresNoInput DISABLED_RequiresNoInput 172 //#define MAYBE_RequiresNoInput DISABLED_RequiresNoInput
173 #else 173 //#else
174 #define MAYBE_RequiresNoInput RequiresNoInput 174 #define MAYBE_RequiresNoInput RequiresNoInput
175 #endif 175 //#endif
xiyuan 2016/11/28 23:38:40 Remove all these and MAYBE_RequiresNoInput -> Requ
kumarniranjan 2016/11/29 23:36:47 Done.
176 176
177 IN_PROC_BROWSER_TEST_F(HandsOffNetworkScreenTest, MAYBE_RequiresNoInput) { 177 IN_PROC_BROWSER_TEST_F(HandsOffNetworkScreenTest, MAYBE_RequiresNoInput) {
178 WizardController* wizard_controller = WizardController::default_controller(); 178 WizardController* wizard_controller = WizardController::default_controller();
179 179
180 // Allow the WizardController to advance throught the enrollment flow. 180 // Allow the WizardController to advance throught the enrollment flow.
181 network_screen_->base_screen_delegate_ = wizard_controller; 181 network_screen_->base_screen_delegate_ = wizard_controller;
182 182
183 // Simulate a network connection. 183 // Simulate a network connection.
184 EXPECT_CALL(*mock_network_state_helper_, IsConnected()) 184 EXPECT_CALL(*mock_network_state_helper_, IsConnected())
185 .Times(AnyNumber())
185 .WillRepeatedly((Return(true))); 186 .WillRepeatedly((Return(true)));
186 network_screen_->UpdateStatus(); 187 network_screen_->UpdateStatus();
187 188
188 // Check if NetworkScreen::OnContinueButtonPressed() is called 189 // Check if NetworkScreen::OnContinueButtonPressed() is called
189 // Note that checking network_screen_->continue_pressed_ is not 190 // Note that checking network_screen_->continue_pressed_ is not
190 // sufficient since there are cases where OnContinueButtonPressed() 191 // sufficient since there are cases where OnContinueButtonPressed()
191 // is called but where this variable is not set to true. 192 // is called but where this variable is not set to true.
192 ASSERT_TRUE((!network_screen_->is_network_subscribed_) && 193 ASSERT_TRUE((!network_screen_->is_network_subscribed_) &&
193 network_screen_->network_state_helper_->IsConnected()); 194 network_screen_->network_state_helper_->IsConnected());
194 195
195 // Check that we reach the enrollment screen. 196 // Wait for the enrollment screen.
196 OobeScreenWaiter(OobeScreen::SCREEN_OOBE_ENROLLMENT).Wait(); 197 OobeScreenWaiter(OobeScreen::SCREEN_OOBE_ENROLLMENT)
198 .WaitNoAssertCurrentScreen();
xiyuan 2016/11/28 23:38:40 Line 185 probably fix the issue. We should not get
kumarniranjan 2016/11/29 23:36:47 Putting the assert back causes the test to fail wi
xiyuan 2016/11/29 23:50:06 0x0B is SCREEN_ERROR_MESSAGE, aka the network erro
197 199
198 // Check that attestation-based enrollment finishes 200 // Check that attestation-based enrollment finishes
199 // with either success or error. 201 // with either success or error.
200 bool done = false; 202 bool done = false;
201 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( 203 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
202 LoginDisplayHost::default_host()->GetOobeUI()->web_ui()->GetWebContents(), 204 LoginDisplayHost::default_host()->GetOobeUI()->web_ui()->GetWebContents(),
203 "var count = 0;" 205 "var count = 0;"
204 "function isVisible(el) {" 206 "function isVisible(el) {"
205 " return window.getComputedStyle(document.getElementById(el)).display" 207 " return window.getComputedStyle(document.getElementById(el)).display"
206 " !== 'none';" 208 " !== 'none';"
(...skipping 11 matching lines...) Expand all
218 "}" 220 "}"
219 "SendReplyIfEnrollmentDone();", 221 "SendReplyIfEnrollmentDone();",
220 &done)); 222 &done));
221 223
222 // Reset the enrollment helper so there is no side effect with other tests. 224 // Reset the enrollment helper so there is no side effect with other tests.
223 static_cast<EnrollmentScreen*>(wizard_controller->current_screen()) 225 static_cast<EnrollmentScreen*>(wizard_controller->current_screen())
224 ->enrollment_helper_.reset(); 226 ->enrollment_helper_.reset();
225 } 227 }
226 228
227 } // namespace chromeos 229 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698