| Index: chrome/browser/ui/webui/options/options_ui_browsertest.cc
|
| diff --git a/chrome/browser/ui/webui/options/options_ui_browsertest.cc b/chrome/browser/ui/webui/options/options_ui_browsertest.cc
|
| index ace30bff9825c177c20d00bdd201cb7b7842173e..4f7e4b85d4d420469ea445b3fdb023be308bdd8b 100644
|
| --- a/chrome/browser/ui/webui/options/options_ui_browsertest.cc
|
| +++ b/chrome/browser/ui/webui/options/options_ui_browsertest.cc
|
| @@ -5,9 +5,9 @@
|
| #include "chrome/browser/ui/webui/options/options_ui_browsertest.h"
|
|
|
| #include "base/prefs/pref_service.h"
|
| +#include "base/scoped_observer.h"
|
| #include "base/strings/string16.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| -#include "chrome/browser/chrome_notification_types.h"
|
| #include "chrome/browser/signin/signin_manager.h"
|
| #include "chrome/browser/signin/signin_manager_factory.h"
|
| #include "chrome/browser/ui/browser.h"
|
| @@ -17,7 +17,6 @@
|
| #include "chrome/common/pref_names.h"
|
| #include "chrome/common/url_constants.h"
|
| #include "chrome/test/base/ui_test_utils.h"
|
| -#include "content/public/browser/notification_service.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "content/public/test/browser_test_utils.h"
|
| #include "content/public/test/test_utils.h"
|
| @@ -47,6 +46,40 @@ namespace options {
|
|
|
| namespace {
|
|
|
| +class SignOutWaiter : public SigninManagerBase::Observer {
|
| + public:
|
| + SignOutWaiter(SigninManagerBase* signin_manager)
|
| + : seen_(false), running_(false), scoped_observer_(this) {
|
| + scoped_observer_.Add(signin_manager);
|
| + }
|
| + virtual ~SignOutWaiter() {}
|
| +
|
| + void Wait() {
|
| + if (seen_)
|
| + return;
|
| +
|
| + running_ = true;
|
| + message_loop_runner_ = new MessageLoopRunner;
|
| + message_loop_runner_->Run();
|
| + EXPECT_TRUE(seen_);
|
| + }
|
| +
|
| + virtual void GoogleSignedOut(const std::string& username) OVERRIDE {
|
| + seen_ = true;
|
| + if (!running_)
|
| + return;
|
| +
|
| + message_loop_runner_->Quit();
|
| + running_ = false;
|
| + }
|
| +
|
| + private:
|
| + bool seen_;
|
| + bool running_;
|
| + ScopedObserver<SigninManagerBase, SignOutWaiter> scoped_observer_;
|
| + scoped_refptr<MessageLoopRunner> message_loop_runner_;
|
| +};
|
| +
|
| #if !defined(OS_CHROMEOS)
|
| void RunClosureWhenProfileInitialized(const base::Closure& closure,
|
| Profile* profile,
|
| @@ -136,15 +169,13 @@ IN_PROC_BROWSER_TEST_F(OptionsUIBrowserTest, VerifyUnmanagedSignout) {
|
|
|
| EXPECT_TRUE(result);
|
|
|
| - content::WindowedNotificationObserver wait_for_signout(
|
| - chrome::NOTIFICATION_GOOGLE_SIGNED_OUT,
|
| - content::NotificationService::AllSources());
|
| + SignOutWaiter sign_out_waiter(signin);
|
|
|
| ASSERT_TRUE(content::ExecuteScript(
|
| browser()->tab_strip_model()->GetActiveWebContents(),
|
| "$('stop-syncing-ok').click();"));
|
|
|
| - wait_for_signout.Wait();
|
| + sign_out_waiter.Wait();
|
|
|
| EXPECT_TRUE(browser()->profile()->GetProfileName() != user);
|
| EXPECT_TRUE(signin->GetAuthenticatedUsername().empty());
|
|
|