| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <list> | 6 #include <list> |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "chrome/browser/browser_thread.h" | 9 #include "chrome/browser/browser_thread.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 269 |
| 270 EXPECT_EQ(kMultiRealmTestRealmCount, n_handlers); | 270 EXPECT_EQ(kMultiRealmTestRealmCount, n_handlers); |
| 271 EXPECT_LT(0, observer.auth_needed_count_); | 271 EXPECT_LT(0, observer.auth_needed_count_); |
| 272 EXPECT_LT(0, observer.auth_supplied_count_); | 272 EXPECT_LT(0, observer.auth_supplied_count_); |
| 273 EXPECT_EQ(0, observer.auth_cancelled_count_); | 273 EXPECT_EQ(0, observer.auth_cancelled_count_); |
| 274 EXPECT_TRUE(test_server()->Stop()); | 274 EXPECT_TRUE(test_server()->Stop()); |
| 275 } | 275 } |
| 276 | 276 |
| 277 // Testing for recovery from an incorrect password for the case where | 277 // Testing for recovery from an incorrect password for the case where |
| 278 // there are multiple authenticated resources. | 278 // there are multiple authenticated resources. |
| 279 // Marked as flaky. See crbug.com/68860 | 279 // Marked as flaky. See http://crbug.com/69266 and http://crbug.com/68860 |
| 280 // TODO(asanka): Remove logging when timeout issues are resolved. |
| 280 IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, FLAKY_IncorrectConfirmation) { | 281 IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, FLAKY_IncorrectConfirmation) { |
| 281 ASSERT_TRUE(test_server()->Start()); | 282 ASSERT_TRUE(test_server()->Start()); |
| 282 GURL test_page = test_server()->GetURL(kSingleRealmTestPage); | 283 GURL test_page = test_server()->GetURL(kSingleRealmTestPage); |
| 283 | 284 |
| 284 TabContentsWrapper* contents = | 285 TabContentsWrapper* contents = |
| 285 browser()->GetSelectedTabContentsWrapper(); | 286 browser()->GetSelectedTabContentsWrapper(); |
| 286 ASSERT_TRUE(contents); | 287 ASSERT_TRUE(contents); |
| 287 | 288 |
| 288 NavigationController* controller = &contents->controller(); | 289 NavigationController* controller = &contents->controller(); |
| 289 LoginPromptBrowserTestObserver observer; | 290 LoginPromptBrowserTestObserver observer; |
| 290 | 291 |
| 291 observer.Register(Source<NavigationController>(controller)); | 292 observer.Register(Source<NavigationController>(controller)); |
| 292 | 293 |
| 293 WindowedLoadStopObserver load_stop_waiter(controller); | 294 WindowedLoadStopObserver load_stop_waiter(controller); |
| 294 | 295 |
| 296 LOG(INFO) << |
| 297 "Begin test run " |
| 298 "(tracing for potential hang. crbug.com/69266)"; |
| 295 { | 299 { |
| 296 WindowedAuthNeededObserver auth_needed_waiter(controller); | 300 WindowedAuthNeededObserver auth_needed_waiter(controller); |
| 297 browser()->OpenURL(test_page, GURL(), CURRENT_TAB, PageTransition::TYPED); | 301 browser()->OpenURL(test_page, GURL(), CURRENT_TAB, PageTransition::TYPED); |
| 302 LOG(INFO) << "Waiting for initial AUTH_NEEDED"; |
| 298 auth_needed_waiter.Wait(); | 303 auth_needed_waiter.Wait(); |
| 299 } | 304 } |
| 300 | 305 |
| 301 EXPECT_FALSE(observer.handlers_.empty()); | 306 EXPECT_FALSE(observer.handlers_.empty()); |
| 302 | 307 |
| 303 if (!observer.handlers_.empty()) { | 308 if (!observer.handlers_.empty()) { |
| 304 WindowedAuthNeededObserver auth_needed_waiter(controller); | 309 WindowedAuthNeededObserver auth_needed_waiter(controller); |
| 305 WindowedAuthSuppliedObserver auth_supplied_waiter(controller); | 310 WindowedAuthSuppliedObserver auth_supplied_waiter(controller); |
| 306 LoginHandler* handler = *observer.handlers_.begin(); | 311 LoginHandler* handler = *observer.handlers_.begin(); |
| 307 | 312 |
| 308 ASSERT_TRUE(handler); | 313 ASSERT_TRUE(handler); |
| 309 handler->SetAuth(bad_username_, bad_password_); | 314 handler->SetAuth(bad_username_, bad_password_); |
| 315 LOG(INFO) << "Waiting for initial AUTH_SUPPLIED"; |
| 310 auth_supplied_waiter.Wait(); | 316 auth_supplied_waiter.Wait(); |
| 311 | 317 |
| 312 // The request should be retried after the incorrect password is | 318 // The request should be retried after the incorrect password is |
| 313 // supplied. This should result in a new AUTH_NEEDED notification | 319 // supplied. This should result in a new AUTH_NEEDED notification |
| 314 // for the same realm. | 320 // for the same realm. |
| 321 LOG(INFO) << "Waiting for secondary AUTH_NEEDED"; |
| 315 auth_needed_waiter.Wait(); | 322 auth_needed_waiter.Wait(); |
| 316 } | 323 } |
| 317 | 324 |
| 318 int n_handlers = 0; | 325 int n_handlers = 0; |
| 319 | 326 |
| 320 while (n_handlers < 1) { | 327 while (n_handlers < 1) { |
| 321 WindowedAuthNeededObserver auth_needed_waiter(controller); | 328 WindowedAuthNeededObserver auth_needed_waiter(controller); |
| 322 | 329 |
| 323 while (!observer.handlers_.empty()) { | 330 while (!observer.handlers_.empty()) { |
| 324 WindowedAuthSuppliedObserver auth_supplied_waiter(controller); | 331 WindowedAuthSuppliedObserver auth_supplied_waiter(controller); |
| 325 LoginHandler* handler = *observer.handlers_.begin(); | 332 LoginHandler* handler = *observer.handlers_.begin(); |
| 326 | 333 |
| 327 ASSERT_TRUE(handler); | 334 ASSERT_TRUE(handler); |
| 328 n_handlers++; | 335 n_handlers++; |
| 329 SetAuthFor(handler); | 336 SetAuthFor(handler); |
| 337 LOG(INFO) << "Waiting for secondary AUTH_SUPPLIED"; |
| 330 auth_supplied_waiter.Wait(); | 338 auth_supplied_waiter.Wait(); |
| 331 } | 339 } |
| 332 | 340 |
| 333 if (n_handlers < 1) | 341 if (n_handlers < 1) { |
| 342 LOG(INFO) << "Waiting for additional AUTH_NEEDED"; |
| 334 auth_needed_waiter.Wait(); | 343 auth_needed_waiter.Wait(); |
| 344 } |
| 335 } | 345 } |
| 336 | 346 |
| 337 load_stop_waiter.Wait(); | |
| 338 | |
| 339 // The single realm test has only one realm, and thus only one login | 347 // The single realm test has only one realm, and thus only one login |
| 340 // prompt. | 348 // prompt. |
| 341 EXPECT_EQ(1, n_handlers); | 349 EXPECT_EQ(1, n_handlers); |
| 342 EXPECT_LT(0, observer.auth_needed_count_); | 350 EXPECT_LT(0, observer.auth_needed_count_); |
| 343 EXPECT_LT(0, observer.auth_supplied_count_); | |
| 344 EXPECT_EQ(0, observer.auth_cancelled_count_); | 351 EXPECT_EQ(0, observer.auth_cancelled_count_); |
| 352 EXPECT_EQ(observer.auth_needed_count_, observer.auth_supplied_count_); |
| 353 LOG(INFO) << "Waiting for LOAD_STOP"; |
| 354 load_stop_waiter.Wait(); |
| 345 EXPECT_TRUE(test_server()->Stop()); | 355 EXPECT_TRUE(test_server()->Stop()); |
| 356 LOG(INFO) << "Done with test"; |
| 346 } | 357 } |
| 347 } // namespace | 358 } // namespace |
| OLD | NEW |