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 | |
64 WindowedLoadStopObserver::WindowedLoadStopObserver( | 60 WindowedLoadStopObserver::WindowedLoadStopObserver( |
65 content::NavigationController* controller, | 61 content::NavigationController* controller, |
66 int notification_count) | 62 int notification_count) |
67 : WindowedNavigationObserver<content::NOTIFICATION_LOAD_STOP>(controller), | 63 : WindowedNavigationObserver<content::NOTIFICATION_LOAD_STOP>(controller), |
68 remaining_notification_count_(notification_count) { | 64 remaining_notification_count_(notification_count) { |
69 // This should really be an ASSERT, if those were allowed in a method which | 65 // This should really be an ASSERT, if those were allowed in a method which |
70 // does not return void. | 66 // does not return void. |
71 EXPECT_LE(0, remaining_notification_count_); | 67 EXPECT_LE(0, remaining_notification_count_); |
72 } | 68 } |
73 | 69 |
74 void WindowedLoadStopObserver::Observe( | 70 void WindowedLoadStopObserver::Observe( |
75 int type, | 71 int type, |
76 const content::NotificationSource& source, | 72 const content::NotificationSource& source, |
77 const content::NotificationDetails& details) { | 73 const content::NotificationDetails& details) { |
78 ASSERT_LT(0, remaining_notification_count_); | 74 ASSERT_LT(0, remaining_notification_count_); |
79 if (--remaining_notification_count_ == 0) | 75 if (--remaining_notification_count_ == 0) |
80 WindowedNotificationObserver::Observe(type, source, details); | 76 WindowedNotificationObserver::Observe(type, source, details); |
81 } | 77 } |
OLD | NEW |