| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 <memory> | 5 #include <memory> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/command_line.h" |
| 8 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 9 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 10 #include "chrome/browser/chromeos/login/login_manager_test.h" | 11 #include "chrome/browser/chromeos/login/login_manager_test.h" |
| 11 #include "chrome/browser/chromeos/login/startup_utils.h" | 12 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 12 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" | 13 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" |
| 13 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 14 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 14 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 15 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
| 16 #include "chromeos/chromeos_switches.h" |
| 15 #include "chromeos/dbus/dbus_thread_manager.h" | 17 #include "chromeos/dbus/dbus_thread_manager.h" |
| 16 #include "chromeos/dbus/fake_cryptohome_client.h" | 18 #include "chromeos/dbus/fake_cryptohome_client.h" |
| 17 | 19 |
| 18 namespace chromeos { | 20 namespace chromeos { |
| 19 | 21 |
| 20 namespace { | 22 namespace { |
| 21 | 23 |
| 22 constexpr char kTestUser1[] = "test-user1@gmail.com"; | 24 constexpr char kTestUser1[] = "test-user1@gmail.com"; |
| 23 constexpr char kTestUser2[] = "test-user2@gmail.com"; | 25 constexpr char kTestUser2[] = "test-user2@gmail.com"; |
| 24 | 26 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 55 | 57 |
| 56 IN_PROC_BROWSER_TEST_F(UserSelectionScreenTest, | 58 IN_PROC_BROWSER_TEST_F(UserSelectionScreenTest, |
| 57 PRE_ShowDircryptoMigrationBanner) { | 59 PRE_ShowDircryptoMigrationBanner) { |
| 58 RegisterUser(kTestUser1); | 60 RegisterUser(kTestUser1); |
| 59 RegisterUser(kTestUser2); | 61 RegisterUser(kTestUser2); |
| 60 StartupUtils::MarkOobeCompleted(); | 62 StartupUtils::MarkOobeCompleted(); |
| 61 } | 63 } |
| 62 | 64 |
| 63 // Test that a banner shows up for users that need dircrypto migration. | 65 // Test that a banner shows up for users that need dircrypto migration. |
| 64 IN_PROC_BROWSER_TEST_F(UserSelectionScreenTest, ShowDircryptoMigrationBanner) { | 66 IN_PROC_BROWSER_TEST_F(UserSelectionScreenTest, ShowDircryptoMigrationBanner) { |
| 67 // Enable ARC. Otherwise, the banner would not show. |
| 68 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 69 switches::kArcAvailability, "officially-supported"); |
| 70 |
| 65 // No banner for the first user since default is no migration. | 71 // No banner for the first user since default is no migration. |
| 66 JSExpect("!$('signin-banner').classList.contains('message-set')"); | 72 JSExpect("!$('signin-banner').classList.contains('message-set')"); |
| 67 | 73 |
| 68 // Change the needs dircrypto migration response. | 74 // Change the needs dircrypto migration response. |
| 69 fake_cryptohome_client()->set_needs_dircrypto_migration(true); | 75 fake_cryptohome_client()->set_needs_dircrypto_migration(true); |
| 70 | 76 |
| 71 // Focus to the 2nd user pod. | 77 // Focus to the 2nd user pod. |
| 72 base::RunLoop pod_focus_wait_loop; | 78 base::RunLoop pod_focus_wait_loop; |
| 73 GetOobeUI()->signin_screen_handler()->SetFocusPODCallbackForTesting( | 79 GetOobeUI()->signin_screen_handler()->SetFocusPODCallbackForTesting( |
| 74 pod_focus_wait_loop.QuitClosure()); | 80 pod_focus_wait_loop.QuitClosure()); |
| 75 js_checker().Evaluate("$('pod-row').focusPod($('pod-row').pods[1])"); | 81 js_checker().Evaluate("$('pod-row').focusPod($('pod-row').pods[1])"); |
| 76 pod_focus_wait_loop.Run(); | 82 pod_focus_wait_loop.Run(); |
| 77 | 83 |
| 78 // Wait for FakeCryptohomeClient to send back the check result. | 84 // Wait for FakeCryptohomeClient to send back the check result. |
| 79 base::RunLoop().RunUntilIdle(); | 85 base::RunLoop().RunUntilIdle(); |
| 80 | 86 |
| 81 // Banner should be shown for the 2nd user. | 87 // Banner should be shown for the 2nd user. |
| 82 JSExpect("$('signin-banner').classList.contains('message-set')"); | 88 JSExpect("$('signin-banner').classList.contains('message-set')"); |
| 83 } | 89 } |
| 84 | 90 |
| 85 } // namespace chromeos | 91 } // namespace chromeos |
| OLD | NEW |