OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 5 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 // server to avoid pending data loads that could be lingering on tear down and | 354 // server to avoid pending data loads that could be lingering on tear down and |
355 // cause DCHECK failure in utility_process_host_impl.cc. | 355 // cause DCHECK failure in utility_process_host_impl.cc. |
356 manager()->AddApp("fake_app_1"); | 356 manager()->AddApp("fake_app_1"); |
357 manager()->AddApp("fake_app_2"); | 357 manager()->AddApp("fake_app_2"); |
358 EXPECT_EQ("fake_app_1,fake_app_2", GetAppIds()); | 358 EXPECT_EQ("fake_app_1,fake_app_2", GetAppIds()); |
359 | 359 |
360 // Set an auto launch app. | 360 // Set an auto launch app. |
361 manager()->SetAutoLaunchApp("fake_app_1"); | 361 manager()->SetAutoLaunchApp("fake_app_1"); |
362 EXPECT_EQ("fake_app_1", manager()->GetAutoLaunchApp()); | 362 EXPECT_EQ("fake_app_1", manager()->GetAutoLaunchApp()); |
363 | 363 |
| 364 // Make sure that if an app was auto launched, it is reflected in the |
| 365 // app data. |
| 366 KioskAppManager::App app; |
| 367 manager()->GetApp("fake_app_1", &app); |
| 368 EXPECT_FALSE(app.was_auto_launched); |
| 369 |
| 370 manager()->SetAppWasAutoLaunched("fake_app_1"); |
| 371 manager()->GetApp("fake_app_1", &app); |
| 372 EXPECT_TRUE(app.was_auto_launched); |
| 373 |
364 // Clear the auto launch app. | 374 // Clear the auto launch app. |
365 manager()->SetAutoLaunchApp(""); | 375 manager()->SetAutoLaunchApp(""); |
366 EXPECT_EQ("", manager()->GetAutoLaunchApp()); | 376 EXPECT_EQ("", manager()->GetAutoLaunchApp()); |
367 EXPECT_FALSE(manager()->IsAutoLaunchEnabled()); | 377 EXPECT_FALSE(manager()->IsAutoLaunchEnabled()); |
368 | 378 |
| 379 // App should still report it was auto launched even though it is no longer |
| 380 // set to auto launch in the future. |
| 381 manager()->GetApp("fake_app_1", &app); |
| 382 EXPECT_TRUE(app.was_auto_launched); |
| 383 |
369 // Set another auto launch app. | 384 // Set another auto launch app. |
370 manager()->SetAutoLaunchApp("fake_app_2"); | 385 manager()->SetAutoLaunchApp("fake_app_2"); |
371 EXPECT_EQ("fake_app_2", manager()->GetAutoLaunchApp()); | 386 EXPECT_EQ("fake_app_2", manager()->GetAutoLaunchApp()); |
372 | 387 |
373 // Check auto launch permissions. | 388 // Check auto launch permissions. |
374 EXPECT_FALSE(manager()->IsAutoLaunchEnabled()); | 389 EXPECT_FALSE(manager()->IsAutoLaunchEnabled()); |
375 manager()->SetEnableAutoLaunch(true); | 390 manager()->SetEnableAutoLaunch(true); |
376 EXPECT_TRUE(manager()->IsAutoLaunchEnabled()); | 391 EXPECT_TRUE(manager()->IsAutoLaunchEnabled()); |
377 | 392 |
378 // Remove the auto launch app. | 393 // Remove the auto launch app. |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 manager()->GetConsumerKioskAutoLaunchStatus( | 696 manager()->GetConsumerKioskAutoLaunchStatus( |
682 base::Bind(&ConsumerKioskAutoLaunchStatusCheck, | 697 base::Bind(&ConsumerKioskAutoLaunchStatusCheck, |
683 status.get(), | 698 status.get(), |
684 runner3->QuitClosure())); | 699 runner3->QuitClosure())); |
685 runner3->Run(); | 700 runner3->Run(); |
686 EXPECT_EQ(*status.get(), | 701 EXPECT_EQ(*status.get(), |
687 KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_DISABLED); | 702 KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_DISABLED); |
688 } | 703 } |
689 | 704 |
690 } // namespace chromeos | 705 } // namespace chromeos |
OLD | NEW |