Commit c741885a authored by dzhioev@chromium.org's avatar dzhioev@chromium.org

Added test checking that m-p user adding UI is visible after show.

We have been reported that user adding UI was invisible once in M35.
I was not able to find the source of this problem, maybe it is gone
already. I wrote this test, just in case.

BUG=362153
TEST=UserAddingScreenTest.*ScreenVisibility

Review URL: https://codereview.chromium.org/290083005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271030 0039d316-1c4b-4281-b951-d872f2087c98
parent 110c31dd
......@@ -5,10 +5,14 @@
#include "ash/session/session_state_delegate.h"
#include "ash/shell.h"
#include "base/prefs/pref_service.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/login/lock/screen_locker.h"
#include "chrome/browser/chromeos/login/lock/screen_locker_tester.h"
#include "chrome/browser/chromeos/login/login_manager_test.h"
#include "chrome/browser/chromeos/login/startup_utils.h"
#include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
#include "chrome/browser/chromeos/login/ui/user_adding_screen.h"
#include "chrome/browser/chromeos/login/ui/webui_login_view.h"
#include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h"
#include "chrome/browser/chromeos/login/users/user_manager.h"
#include "chrome/common/chrome_switches.h"
......@@ -55,6 +59,24 @@ class UserAddingScreenTest : public LoginManagerTest,
user->set_can_lock(can_lock);
}
void CheckScreenIsVisible() {
views::View* web_view =
LoginDisplayHostImpl::default_host()->GetWebUILoginView()->child_at(0);
for (views::View* current_view = web_view;
current_view;
current_view = current_view->parent()) {
EXPECT_TRUE(current_view->visible());
if (current_view->layer())
EXPECT_EQ(current_view->layer()->GetCombinedOpacity(), 1.f);
}
for (aura::Window* window = web_view->GetWidget()->GetNativeWindow();
window;
window = window->parent()) {
EXPECT_TRUE(window->IsVisible());
EXPECT_EQ(window->layer()->GetCombinedOpacity(), 1.f);
}
}
int user_adding_started() { return user_adding_started_; }
int user_adding_finished() { return user_adding_finished_; }
......@@ -213,4 +235,37 @@ IN_PROC_BROWSER_TEST_F(UserAddingScreenTest, AddingSeveralUsers) {
EXPECT_EQ(kTestUsers[i], unlock_users[i]->email());
}
IN_PROC_BROWSER_TEST_F(UserAddingScreenTest, PRE_ScreenVisibility) {
RegisterUser(kTestUsers[0]);
RegisterUser(kTestUsers[1]);
StartupUtils::MarkOobeCompleted();
}
// Trying to catch http://crbug.com/362153.
IN_PROC_BROWSER_TEST_F(UserAddingScreenTest, ScreenVisibility) {
LoginUser(kTestUsers[0]);
UserAddingScreen::Get()->Start();
content::RunAllPendingInMessageLoop();
CheckScreenIsVisible();
UserAddingScreen::Get()->Cancel();
content::RunAllPendingInMessageLoop();
ScreenLocker::Show();
content::WindowedNotificationObserver(
chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED,
content::NotificationService::AllSources()).Wait();
ScreenLocker::Hide();
content::WindowedNotificationObserver(
chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED,
content::NotificationService::AllSources()).Wait();
UserAddingScreen::Get()->Start();
content::RunAllPendingInMessageLoop();
CheckScreenIsVisible();
UserAddingScreen::Get()->Cancel();
content::RunAllPendingInMessageLoop();
}
} // namespace chromeos
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment