diff options
author | glotov@chromium.org <glotov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-19 13:17:55 +0000 |
---|---|---|
committer | glotov@chromium.org <glotov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-19 13:17:55 +0000 |
commit | 1ce9bfec9248026c844218c5e340a608af884ad9 (patch) | |
tree | 1d3a0c1405984b0bbd23dcaff0c30097bec28d53 | |
parent | 3d5c5383b1d6c1a5db3a0d3ed746e5d334877c99 (diff) | |
download | chromium_src-1ce9bfec9248026c844218c5e340a608af884ad9.zip chromium_src-1ce9bfec9248026c844218c5e340a608af884ad9.tar.gz chromium_src-1ce9bfec9248026c844218c5e340a608af884ad9.tar.bz2 |
Fix the data race of OobeTest.NewUser browser test and enable it.
BUG=178009
TEST=for i in {1..20}; do \
out/Debug/interactive_ui_tests --gtest_filter=OobeTest.NewUser --disable-test-compositor; \
if [ $? != 0 ]; then break; fi; \
done;
Review URL: https://chromiumcodereview.appspot.com/13895008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195157 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chromeos/login/oobe_browsertest.cc | 48 | ||||
-rw-r--r-- | chrome/browser/resources/chromeos/login/screen_gaia_signin.js | 2 |
2 files changed, 35 insertions, 15 deletions
diff --git a/chrome/browser/chromeos/login/oobe_browsertest.cc b/chrome/browser/chromeos/login/oobe_browsertest.cc index bb1f707..e66246b 100644 --- a/chrome/browser/chromeos/login/oobe_browsertest.cc +++ b/chrome/browser/chromeos/login/oobe_browsertest.cc @@ -40,7 +40,10 @@ class TestBrowserMainExtraParts : public ChromeBrowserMainExtraParts, public content::NotificationObserver { public: - TestBrowserMainExtraParts() {} + TestBrowserMainExtraParts() + : webui_visible_(false), + browsing_data_removed_(false), + signin_screen_shown_(false) {} virtual ~TestBrowserMainExtraParts() {} // ChromeBrowserMainExtraParts implementation. @@ -49,6 +52,8 @@ class TestBrowserMainExtraParts content::NotificationService::AllSources()); registrar_.Add(this, chrome::NOTIFICATION_SESSION_STARTED, content::NotificationService::AllSources()); + registrar_.Add(this, chrome::NOTIFICATION_BROWSING_DATA_REMOVED, + content::NotificationService::AllSources()); } void set_quit_task(const base::Closure& quit_task) { quit_task_ = quit_task; } @@ -61,17 +66,18 @@ class TestBrowserMainExtraParts const content::NotificationDetails& details) OVERRIDE { if (type == chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE) { LOG(INFO) << "NOTIFICATION_LOGIN_WEBUI_VISIBLE"; - chromeos::ExistingUserController* controller = - chromeos::ExistingUserController::current_controller(); - CHECK(controller); - chromeos::WebUILoginDisplay* webui_login_display = - static_cast<chromeos::WebUILoginDisplay*>( - controller->login_display()); - CHECK(webui_login_display); - webui_login_display->SetGaiaOriginForTesting(gaia_url_); - webui_login_display->ShowSigninScreenForCreds("username", "password"); - // TODO(glotov): mock GAIA server (test_server_) should support - // username/password configuration. + webui_visible_ = true; + if (browsing_data_removed_ && !signin_screen_shown_) { + signin_screen_shown_ = true; + ShowSigninScreen(); + } + } else if (type == chrome::NOTIFICATION_BROWSING_DATA_REMOVED) { + LOG(INFO) << "chrome::NOTIFICATION_BROWSING_DATA_REMOVED"; + browsing_data_removed_ = true; + if (webui_visible_ && !signin_screen_shown_) { + signin_screen_shown_ = true; + ShowSigninScreen(); + } } else if (type == chrome::NOTIFICATION_SESSION_STARTED) { LOG(INFO) << "chrome::NOTIFICATION_SESSION_STARTED"; quit_task_.Run(); @@ -80,6 +86,21 @@ class TestBrowserMainExtraParts } } + void ShowSigninScreen() { + chromeos::ExistingUserController* controller = + chromeos::ExistingUserController::current_controller(); + CHECK(controller); + chromeos::WebUILoginDisplay* webui_login_display = + static_cast<chromeos::WebUILoginDisplay*>( + controller->login_display()); + CHECK(webui_login_display); + webui_login_display->SetGaiaOriginForTesting(gaia_url_); + webui_login_display->ShowSigninScreenForCreds("username", "password"); + // TODO(glotov): mock GAIA server (test_server_) should support + // username/password configuration. + } + + bool webui_visible_, browsing_data_removed_, signin_screen_shown_; content::NotificationRegistrar registrar_; base::Closure quit_task_; std::string gaia_url_; @@ -187,8 +208,7 @@ class OobeTest : public chromeos::CrosInProcessBrowserTest { // needs UI thread. }; -// Temporally disabled because of a race: crbug.com/178009 -IN_PROC_BROWSER_TEST_F(OobeTest, DISABLED_NewUser) { +IN_PROC_BROWSER_TEST_F(OobeTest, NewUser) { chromeos::WizardController::SkipPostLoginScreensForTesting(); chromeos::WizardController* wizard_controller = chromeos::WizardController::default_controller(); diff --git a/chrome/browser/resources/chromeos/login/screen_gaia_signin.js b/chrome/browser/resources/chromeos/login/screen_gaia_signin.js index 56982d2..19bcd67 100644 --- a/chrome/browser/resources/chromeos/login/screen_gaia_signin.js +++ b/chrome/browser/resources/chromeos/login/screen_gaia_signin.js @@ -9,7 +9,7 @@ cr.define('login', function() { // Gaia loading time after which error message must be displayed and // lazy portal check should be fired. - /** @const */ var GAIA_LOADING_PORTAL_SUSSPECT_TIME_SEC = 15; + /** @const */ var GAIA_LOADING_PORTAL_SUSSPECT_TIME_SEC = 7; // Maximum Gaia loading time in seconds. /** @const */ var MAX_GAIA_LOADING_TIME_SEC = 60; |