| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/login/login_handler_test_utils.h" | 5 #include "chrome/browser/ui/login/login_handler_test_utils.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/login/login_handler.h" | 7 #include "chrome/browser/ui/login/login_handler.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 LoginPromptBrowserTestObserver::LoginPromptBrowserTestObserver() | 10 LoginPromptBrowserTestObserver::LoginPromptBrowserTestObserver() |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 handlers_.erase(i); | 50 handlers_.erase(i); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void LoginPromptBrowserTestObserver::Register( | 53 void LoginPromptBrowserTestObserver::Register( |
| 54 const content::NotificationSource& source) { | 54 const content::NotificationSource& source) { |
| 55 registrar_.Add(this, chrome::NOTIFICATION_AUTH_NEEDED, source); | 55 registrar_.Add(this, chrome::NOTIFICATION_AUTH_NEEDED, source); |
| 56 registrar_.Add(this, chrome::NOTIFICATION_AUTH_SUPPLIED, source); | 56 registrar_.Add(this, chrome::NOTIFICATION_AUTH_SUPPLIED, source); |
| 57 registrar_.Add(this, chrome::NOTIFICATION_AUTH_CANCELLED, source); | 57 registrar_.Add(this, chrome::NOTIFICATION_AUTH_CANCELLED, source); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void LoginPromptBrowserTestObserver::UnregisterAll() { |
| 61 registrar_.RemoveAll(); |
| 62 } |
| 63 |
| 60 WindowedLoadStopObserver::WindowedLoadStopObserver( | 64 WindowedLoadStopObserver::WindowedLoadStopObserver( |
| 61 content::NavigationController* controller, | 65 content::NavigationController* controller, |
| 62 int notification_count) | 66 int notification_count) |
| 63 : WindowedNavigationObserver<content::NOTIFICATION_LOAD_STOP>(controller), | 67 : WindowedNavigationObserver<content::NOTIFICATION_LOAD_STOP>(controller), |
| 64 remaining_notification_count_(notification_count) { | 68 remaining_notification_count_(notification_count) { |
| 65 // This should really be an ASSERT, if those were allowed in a method which | 69 // This should really be an ASSERT, if those were allowed in a method which |
| 66 // does not return void. | 70 // does not return void. |
| 67 EXPECT_LE(0, remaining_notification_count_); | 71 EXPECT_LE(0, remaining_notification_count_); |
| 68 } | 72 } |
| 69 | 73 |
| 70 void WindowedLoadStopObserver::Observe( | 74 void WindowedLoadStopObserver::Observe( |
| 71 int type, | 75 int type, |
| 72 const content::NotificationSource& source, | 76 const content::NotificationSource& source, |
| 73 const content::NotificationDetails& details) { | 77 const content::NotificationDetails& details) { |
| 74 ASSERT_LT(0, remaining_notification_count_); | 78 ASSERT_LT(0, remaining_notification_count_); |
| 75 if (--remaining_notification_count_ == 0) | 79 if (--remaining_notification_count_ == 0) |
| 76 WindowedNotificationObserver::Observe(type, source, details); | 80 WindowedNotificationObserver::Observe(type, source, details); |
| 77 } | 81 } |
| OLD | NEW |