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/file_util.h" | 8 #include "base/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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 manager()->GetApps(&apps); | 544 manager()->GetApps(&apps); |
545 ASSERT_EQ(1u, apps.size()); | 545 ASSERT_EQ(1u, apps.size()); |
546 base::FilePath crx_path; | 546 base::FilePath crx_path; |
547 std::string version; | 547 std::string version; |
548 EXPECT_TRUE(GetCachedCrx(kTestLocalFsKioskApp, &crx_path, &version)); | 548 EXPECT_TRUE(GetCachedCrx(kTestLocalFsKioskApp, &crx_path, &version)); |
549 EXPECT_TRUE(base::PathExists(crx_path)); | 549 EXPECT_TRUE(base::PathExists(crx_path)); |
550 EXPECT_EQ("1.0.0", version); | 550 EXPECT_EQ("1.0.0", version); |
551 | 551 |
552 // Remove the app now. | 552 // Remove the app now. |
553 manager()->RemoveApp(kTestLocalFsKioskApp); | 553 manager()->RemoveApp(kTestLocalFsKioskApp); |
554 content::RunAllPendingInMessageLoop(BrowserThread::FILE); | 554 content::BrowserThread::GetBlockingPool()->FlushForTesting(); |
555 manager()->GetApps(&apps); | 555 manager()->GetApps(&apps); |
556 ASSERT_EQ(0u, apps.size()); | 556 ASSERT_EQ(0u, apps.size()); |
557 EXPECT_FALSE(base::PathExists(crx_path)); | 557 EXPECT_FALSE(base::PathExists(crx_path)); |
558 EXPECT_FALSE(GetCachedCrx(kTestLocalFsKioskApp, &crx_path, &version)); | 558 EXPECT_FALSE(GetCachedCrx(kTestLocalFsKioskApp, &crx_path, &version)); |
559 } | 559 } |
560 | 560 |
561 IN_PROC_BROWSER_TEST_F(KioskAppManagerTest, UpdateApp) { | 561 IN_PROC_BROWSER_TEST_F(KioskAppManagerTest, UpdateApp) { |
562 // Add a version 1 app first. | 562 // Add a version 1 app first. |
563 RunAddNewAppTest(kTestLocalFsKioskApp, "1.0.0", kTestLocalFsKioskAppName); | 563 RunAddNewAppTest(kTestLocalFsKioskApp, "1.0.0", kTestLocalFsKioskAppName); |
564 KioskAppManager::Apps apps; | 564 KioskAppManager::Apps apps; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 base::FilePath v2_crx_path; | 626 base::FilePath v2_crx_path; |
627 std::string new_version; | 627 std::string new_version; |
628 EXPECT_TRUE(GetCachedCrx(kTestLocalFsKioskApp, &v2_crx_path, &new_version)); | 628 EXPECT_TRUE(GetCachedCrx(kTestLocalFsKioskApp, &v2_crx_path, &new_version)); |
629 EXPECT_EQ("2.0.0", new_version); | 629 EXPECT_EQ("2.0.0", new_version); |
630 // Verify both v1 and v2 crx files exist. | 630 // Verify both v1 and v2 crx files exist. |
631 EXPECT_TRUE(base::PathExists(v1_crx_path)); | 631 EXPECT_TRUE(base::PathExists(v1_crx_path)); |
632 EXPECT_TRUE(base::PathExists(v2_crx_path)); | 632 EXPECT_TRUE(base::PathExists(v2_crx_path)); |
633 | 633 |
634 // Remove the app now. | 634 // Remove the app now. |
635 manager()->RemoveApp(kTestLocalFsKioskApp); | 635 manager()->RemoveApp(kTestLocalFsKioskApp); |
636 content::RunAllPendingInMessageLoop(BrowserThread::FILE); | 636 content::BrowserThread::GetBlockingPool()->FlushForTesting(); |
637 manager()->GetApps(&apps); | 637 manager()->GetApps(&apps); |
638 ASSERT_EQ(0u, apps.size()); | 638 ASSERT_EQ(0u, apps.size()); |
639 // Verify both v1 and v2 crx files are removed. | 639 // Verify both v1 and v2 crx files are removed. |
640 EXPECT_FALSE(base::PathExists(v1_crx_path)); | 640 EXPECT_FALSE(base::PathExists(v1_crx_path)); |
641 EXPECT_FALSE(base::PathExists(v2_crx_path)); | 641 EXPECT_FALSE(base::PathExists(v2_crx_path)); |
642 EXPECT_FALSE(GetCachedCrx(kTestLocalFsKioskApp, &v2_crx_path, &version)); | 642 EXPECT_FALSE(GetCachedCrx(kTestLocalFsKioskApp, &v2_crx_path, &version)); |
643 } | 643 } |
644 | 644 |
645 IN_PROC_BROWSER_TEST_F(KioskAppManagerTest, EnableConsumerKiosk) { | 645 IN_PROC_BROWSER_TEST_F(KioskAppManagerTest, EnableConsumerKiosk) { |
646 scoped_ptr<KioskAppManager::ConsumerKioskAutoLaunchStatus> status( | 646 scoped_ptr<KioskAppManager::ConsumerKioskAutoLaunchStatus> status( |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 manager()->GetConsumerKioskAutoLaunchStatus( | 713 manager()->GetConsumerKioskAutoLaunchStatus( |
714 base::Bind(&ConsumerKioskAutoLaunchStatusCheck, | 714 base::Bind(&ConsumerKioskAutoLaunchStatusCheck, |
715 status.get(), | 715 status.get(), |
716 runner3->QuitClosure())); | 716 runner3->QuitClosure())); |
717 runner3->Run(); | 717 runner3->Run(); |
718 EXPECT_EQ(*status.get(), | 718 EXPECT_EQ(*status.get(), |
719 KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_DISABLED); | 719 KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_DISABLED); |
720 } | 720 } |
721 | 721 |
722 } // namespace chromeos | 722 } // namespace chromeos |
OLD | NEW |