| 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 #ifndef CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_TEST_UTILS_H_ | 5 #ifndef CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_TEST_UTILS_H_ |
| 6 #define CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_TEST_UTILS_H_ | 6 #define CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| 11 #include "content/public/browser/navigation_controller.h" | 11 #include "content/public/browser/navigation_controller.h" |
| 12 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
| 13 #include "content/public/test/test_utils.h" | 13 #include "content/public/test/test_utils.h" |
| 14 | 14 |
| 15 class LoginHandler; | 15 class LoginHandler; |
| 16 | 16 |
| 17 // Maintains a set of LoginHandlers that are currently active and | 17 // Maintains a set of LoginHandlers that are currently active and |
| 18 // keeps a count of the notifications that were observed. | 18 // keeps a count of the notifications that were observed. |
| 19 class LoginPromptBrowserTestObserver : public content::NotificationObserver { | 19 class LoginPromptBrowserTestObserver : public content::NotificationObserver { |
| 20 public: | 20 public: |
| 21 LoginPromptBrowserTestObserver(); | 21 LoginPromptBrowserTestObserver(); |
| 22 virtual ~LoginPromptBrowserTestObserver(); | 22 virtual ~LoginPromptBrowserTestObserver(); |
| 23 | 23 |
| 24 virtual void Observe(int type, | 24 virtual void Observe(int type, |
| 25 const content::NotificationSource& source, | 25 const content::NotificationSource& source, |
| 26 const content::NotificationDetails& details) OVERRIDE; | 26 const content::NotificationDetails& details) override; |
| 27 | 27 |
| 28 void AddHandler(LoginHandler* handler); | 28 void AddHandler(LoginHandler* handler); |
| 29 | 29 |
| 30 void RemoveHandler(LoginHandler* handler); | 30 void RemoveHandler(LoginHandler* handler); |
| 31 | 31 |
| 32 void Register(const content::NotificationSource& source); | 32 void Register(const content::NotificationSource& source); |
| 33 | 33 |
| 34 const std::list<LoginHandler*>& handlers() const { return handlers_; } | 34 const std::list<LoginHandler*>& handlers() const { return handlers_; } |
| 35 | 35 |
| 36 int auth_needed_count() const { return auth_needed_count_; } | 36 int auth_needed_count() const { return auth_needed_count_; } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // multiple LOAD_STOP events. | 85 // multiple LOAD_STOP events. |
| 86 class WindowedLoadStopObserver | 86 class WindowedLoadStopObserver |
| 87 : public WindowedNavigationObserver<content::NOTIFICATION_LOAD_STOP> { | 87 : public WindowedNavigationObserver<content::NOTIFICATION_LOAD_STOP> { |
| 88 public: | 88 public: |
| 89 WindowedLoadStopObserver(content::NavigationController* controller, | 89 WindowedLoadStopObserver(content::NavigationController* controller, |
| 90 int notification_count); | 90 int notification_count); |
| 91 | 91 |
| 92 protected: | 92 protected: |
| 93 virtual void Observe(int type, | 93 virtual void Observe(int type, |
| 94 const content::NotificationSource& source, | 94 const content::NotificationSource& source, |
| 95 const content::NotificationDetails& details) OVERRIDE; | 95 const content::NotificationDetails& details) override; |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 int remaining_notification_count_; // Number of notifications remaining. | 98 int remaining_notification_count_; // Number of notifications remaining. |
| 99 | 99 |
| 100 DISALLOW_COPY_AND_ASSIGN(WindowedLoadStopObserver); | 100 DISALLOW_COPY_AND_ASSIGN(WindowedLoadStopObserver); |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_TEST_UTILS_H_ | 103 #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_TEST_UTILS_H_ |
| OLD | NEW |