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 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "base/json/json_file_value_serializer.h" | 7 #include "base/json/json_file_value_serializer.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
11 #include "chrome/browser/chromeos/login/login_manager_test.h" | 11 #include "chrome/browser/chromeos/login/login_manager_test.h" |
12 #include "chrome/browser/chromeos/login/startup_utils.h" | 12 #include "chrome/browser/chromeos/login/startup_utils.h" |
13 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" | 13 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" |
14 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 14 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
15 #include "chrome/browser/chromeos/login/ui/oobe_display.h" | 15 #include "chrome/browser/chromeos/login/ui/oobe_display.h" |
16 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" | 16 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
17 #include "chrome/common/chrome_constants.h" | 17 #include "chrome/common/chrome_constants.h" |
18 #include "chrome/common/chrome_paths.h" | 18 #include "chrome/common/chrome_paths.h" |
19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
21 #include "chromeos/chromeos_switches.h" | 21 #include "chromeos/chromeos_switches.h" |
22 #include "chromeos/dbus/dbus_thread_manager.h" | 22 #include "chromeos/dbus/dbus_thread_manager.h" |
23 #include "chromeos/dbus/fake_debug_daemon_client.h" | 23 #include "chromeos/dbus/fake_debug_daemon_client.h" |
24 #include "chromeos/dbus/fake_power_manager_client.h" | 24 #include "chromeos/dbus/fake_power_manager_client.h" |
25 #include "chromeos/dbus/fake_update_engine_client.h" | 25 #include "chromeos/dbus/fake_update_engine_client.h" |
26 #include "content/public/test/browser_test_utils.h" | 26 #include "content/public/test/browser_test_utils.h" |
27 #include "content/public/test/test_utils.h" | 27 #include "content/public/test/test_utils.h" |
| 28 #include "third_party/cros_system_api/dbus/service_constants.h" |
28 | 29 |
29 namespace chromeos { | 30 namespace chromeos { |
30 | 31 |
31 class TestDebugDaemonClient : public FakeDebugDaemonClient { | 32 class TestDebugDaemonClient : public FakeDebugDaemonClient { |
32 public: | 33 public: |
33 TestDebugDaemonClient() | 34 TestDebugDaemonClient() |
34 : got_reply_(false), | 35 : got_reply_(false), |
35 num_query_debugging_features_(0), | 36 num_query_debugging_features_(0), |
36 num_enable_debugging_features_(0), | 37 num_enable_debugging_features_(0), |
37 num_remove_protection_(0) { | 38 num_remove_protection_(0) { |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 | 240 |
240 void VerifyRemoveProtectionScreen() { | 241 void VerifyRemoveProtectionScreen() { |
241 JSExpect("!!document.querySelector('#debugging.remove-protection-view')"); | 242 JSExpect("!!document.querySelector('#debugging.remove-protection-view')"); |
242 JSExpect("!document.querySelector('#debugging.setup-view')"); | 243 JSExpect("!document.querySelector('#debugging.setup-view')"); |
243 JSExpect("!document.querySelector('#debugging.done-view')"); | 244 JSExpect("!document.querySelector('#debugging.done-view')"); |
244 JSExpect("!document.querySelector('#debugging.wait-view')"); | 245 JSExpect("!document.querySelector('#debugging.wait-view')"); |
245 } | 246 } |
246 | 247 |
247 void ShowSetupScreen() { | 248 void ShowSetupScreen() { |
248 debug_daemon_client_->SetDebuggingFeaturesStatus( | 249 debug_daemon_client_->SetDebuggingFeaturesStatus( |
249 DebugDaemonClient::DEV_FEATURE_ROOTFS_VERIFICATION_REMOVED); | 250 debugd::DevFeatureFlag::DEV_FEATURE_ROOTFS_VERIFICATION_REMOVED); |
250 WaitUntilJSIsReady(); | 251 WaitUntilJSIsReady(); |
251 JSExpect("!!document.querySelector('#debugging.hidden')"); | 252 JSExpect("!!document.querySelector('#debugging.hidden')"); |
252 InvokeEnableDebuggingScreen(); | 253 InvokeEnableDebuggingScreen(); |
253 JSExpect("!document.querySelector('#debugging.hidden')"); | 254 JSExpect("!document.querySelector('#debugging.hidden')"); |
254 debug_daemon_client_->WaitUntilCalled(); | 255 debug_daemon_client_->WaitUntilCalled(); |
255 base::MessageLoop::current()->RunUntilIdle(); | 256 base::MessageLoop::current()->RunUntilIdle(); |
256 JSExpect("!document.querySelector('#debugging.remove-protection-view')"); | 257 JSExpect("!document.querySelector('#debugging.remove-protection-view')"); |
257 JSExpect("!!document.querySelector('#debugging.setup-view')"); | 258 JSExpect("!!document.querySelector('#debugging.setup-view')"); |
258 JSExpect("!document.querySelector('#debugging.done-view')"); | 259 JSExpect("!document.querySelector('#debugging.done-view')"); |
259 JSExpect("!document.querySelector('#debugging.wait-view')"); | 260 JSExpect("!document.querySelector('#debugging.wait-view')"); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 base::MessageLoop::current()->RunUntilIdle(); | 300 base::MessageLoop::current()->RunUntilIdle(); |
300 JSExpect("!!document.querySelector('#debugging.done-view')"); | 301 JSExpect("!!document.querySelector('#debugging.done-view')"); |
301 EXPECT_EQ(debug_daemon_client_->num_enable_debugging_features(), 1); | 302 EXPECT_EQ(debug_daemon_client_->num_enable_debugging_features(), 1); |
302 EXPECT_EQ(debug_daemon_client_->num_remove_protection(), 0); | 303 EXPECT_EQ(debug_daemon_client_->num_remove_protection(), 0); |
303 } | 304 } |
304 | 305 |
305 // Test images come with some features enabled but still has rootfs protection. | 306 // Test images come with some features enabled but still has rootfs protection. |
306 // Invoking debug screen should show remove protection screen. | 307 // Invoking debug screen should show remove protection screen. |
307 IN_PROC_BROWSER_TEST_F(EnableDebuggingTest, ShowOnTestImages) { | 308 IN_PROC_BROWSER_TEST_F(EnableDebuggingTest, ShowOnTestImages) { |
308 debug_daemon_client_->SetDebuggingFeaturesStatus( | 309 debug_daemon_client_->SetDebuggingFeaturesStatus( |
309 DebugDaemonClient::DEV_FEATURE_SSH_SERVER_CONFIGURED | | 310 debugd::DevFeatureFlag::DEV_FEATURE_SSH_SERVER_CONFIGURED | |
310 DebugDaemonClient::DEV_FEATURE_SYSTEM_ROOT_PASSWORD_SET); | 311 debugd::DevFeatureFlag::DEV_FEATURE_SYSTEM_ROOT_PASSWORD_SET); |
311 WaitUntilJSIsReady(); | 312 WaitUntilJSIsReady(); |
312 JSExpect("!!document.querySelector('#debugging.hidden')"); | 313 JSExpect("!!document.querySelector('#debugging.hidden')"); |
313 InvokeEnableDebuggingScreen(); | 314 InvokeEnableDebuggingScreen(); |
314 JSExpect("!document.querySelector('#debugging.hidden')"); | 315 JSExpect("!document.querySelector('#debugging.hidden')"); |
315 debug_daemon_client_->WaitUntilCalled(); | 316 debug_daemon_client_->WaitUntilCalled(); |
316 base::MessageLoop::current()->RunUntilIdle(); | 317 base::MessageLoop::current()->RunUntilIdle(); |
317 VerifyRemoveProtectionScreen(); | 318 VerifyRemoveProtectionScreen(); |
318 | 319 |
319 EXPECT_EQ(debug_daemon_client_->num_query_debugging_features(), 1); | 320 EXPECT_EQ(debug_daemon_client_->num_query_debugging_features(), 1); |
320 EXPECT_EQ(debug_daemon_client_->num_enable_debugging_features(), 0); | 321 EXPECT_EQ(debug_daemon_client_->num_enable_debugging_features(), 0); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 user_data_dir.Append(chrome::kLocalStateFilename); | 391 user_data_dir.Append(chrome::kLocalStateFilename); |
391 CHECK( | 392 CHECK( |
392 JSONFileValueSerializer(local_state_path).Serialize(local_state_dict)); | 393 JSONFileValueSerializer(local_state_path).Serialize(local_state_dict)); |
393 | 394 |
394 return EnableDebuggingTest::SetUpUserDataDirectory(); | 395 return EnableDebuggingTest::SetUpUserDataDirectory(); |
395 } | 396 } |
396 void SetUpInProcessBrowserTestFixture() override { | 397 void SetUpInProcessBrowserTestFixture() override { |
397 EnableDebuggingTest::SetUpInProcessBrowserTestFixture(); | 398 EnableDebuggingTest::SetUpInProcessBrowserTestFixture(); |
398 | 399 |
399 debug_daemon_client_->SetDebuggingFeaturesStatus( | 400 debug_daemon_client_->SetDebuggingFeaturesStatus( |
400 DebugDaemonClient::DEV_FEATURE_ROOTFS_VERIFICATION_REMOVED); | 401 debugd::DevFeatureFlag::DEV_FEATURE_ROOTFS_VERIFICATION_REMOVED); |
401 } | 402 } |
402 }; | 403 }; |
403 | 404 |
404 // Setup screen is automatically shown when the feature is requested. | 405 // Setup screen is automatically shown when the feature is requested. |
405 IN_PROC_BROWSER_TEST_F(EnableDebuggingRequestedTest, AutoShowSetup) { | 406 IN_PROC_BROWSER_TEST_F(EnableDebuggingRequestedTest, AutoShowSetup) { |
406 OobeScreenWaiter(OobeDisplay::SCREEN_OOBE_ENABLE_DEBUGGING).Wait(); | 407 OobeScreenWaiter(OobeDisplay::SCREEN_OOBE_ENABLE_DEBUGGING).Wait(); |
407 } | 408 } |
408 | 409 |
409 // Canceling auto shown setup screen should close it. | 410 // Canceling auto shown setup screen should close it. |
410 IN_PROC_BROWSER_TEST_F(EnableDebuggingRequestedTest, CancelAutoShowSetup) { | 411 IN_PROC_BROWSER_TEST_F(EnableDebuggingRequestedTest, CancelAutoShowSetup) { |
411 OobeScreenWaiter(OobeDisplay::SCREEN_OOBE_ENABLE_DEBUGGING).Wait(); | 412 OobeScreenWaiter(OobeDisplay::SCREEN_OOBE_ENABLE_DEBUGGING).Wait(); |
412 CloseEnableDebuggingScreen(); | 413 CloseEnableDebuggingScreen(); |
413 JSExpect("!!document.querySelector('#debugging.hidden')"); | 414 JSExpect("!!document.querySelector('#debugging.hidden')"); |
414 } | 415 } |
415 | 416 |
416 } // namespace chromeos | 417 } // namespace chromeos |
OLD | NEW |