Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: chrome/browser/chromeos/app_mode/kiosk_app_manager_browsertest.cc

Issue 409743003: Use content::RunBlockingPoolTask() in tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 manager()->GetApps(&apps); 514 manager()->GetApps(&apps);
515 ASSERT_EQ(1u, apps.size()); 515 ASSERT_EQ(1u, apps.size());
516 base::FilePath crx_path; 516 base::FilePath crx_path;
517 std::string version; 517 std::string version;
518 EXPECT_TRUE(GetCachedCrx(kTestLocalFsKioskApp, &crx_path, &version)); 518 EXPECT_TRUE(GetCachedCrx(kTestLocalFsKioskApp, &crx_path, &version));
519 EXPECT_TRUE(base::PathExists(crx_path)); 519 EXPECT_TRUE(base::PathExists(crx_path));
520 EXPECT_EQ("1.0.0", version); 520 EXPECT_EQ("1.0.0", version);
521 521
522 // Remove the app now. 522 // Remove the app now.
523 manager()->RemoveApp(kTestLocalFsKioskApp); 523 manager()->RemoveApp(kTestLocalFsKioskApp);
524 content::BrowserThread::GetBlockingPool()->FlushForTesting(); 524 content::RunAllBlockingPoolTasksUntilIdle();
525 manager()->GetApps(&apps); 525 manager()->GetApps(&apps);
526 ASSERT_EQ(0u, apps.size()); 526 ASSERT_EQ(0u, apps.size());
527 EXPECT_FALSE(base::PathExists(crx_path)); 527 EXPECT_FALSE(base::PathExists(crx_path));
528 EXPECT_FALSE(GetCachedCrx(kTestLocalFsKioskApp, &crx_path, &version)); 528 EXPECT_FALSE(GetCachedCrx(kTestLocalFsKioskApp, &crx_path, &version));
529 } 529 }
530 530
531 IN_PROC_BROWSER_TEST_F(KioskAppManagerTest, UpdateApp) { 531 IN_PROC_BROWSER_TEST_F(KioskAppManagerTest, UpdateApp) {
532 // Add a version 1 app first. 532 // Add a version 1 app first.
533 RunAddNewAppTest(kTestLocalFsKioskApp, "1.0.0", kTestLocalFsKioskAppName); 533 RunAddNewAppTest(kTestLocalFsKioskApp, "1.0.0", kTestLocalFsKioskAppName);
534 KioskAppManager::Apps apps; 534 KioskAppManager::Apps apps;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 base::FilePath v2_crx_path; 596 base::FilePath v2_crx_path;
597 std::string new_version; 597 std::string new_version;
598 EXPECT_TRUE(GetCachedCrx(kTestLocalFsKioskApp, &v2_crx_path, &new_version)); 598 EXPECT_TRUE(GetCachedCrx(kTestLocalFsKioskApp, &v2_crx_path, &new_version));
599 EXPECT_EQ("2.0.0", new_version); 599 EXPECT_EQ("2.0.0", new_version);
600 // Verify both v1 and v2 crx files exist. 600 // Verify both v1 and v2 crx files exist.
601 EXPECT_TRUE(base::PathExists(v1_crx_path)); 601 EXPECT_TRUE(base::PathExists(v1_crx_path));
602 EXPECT_TRUE(base::PathExists(v2_crx_path)); 602 EXPECT_TRUE(base::PathExists(v2_crx_path));
603 603
604 // Remove the app now. 604 // Remove the app now.
605 manager()->RemoveApp(kTestLocalFsKioskApp); 605 manager()->RemoveApp(kTestLocalFsKioskApp);
606 content::BrowserThread::GetBlockingPool()->FlushForTesting(); 606 content::RunAllBlockingPoolTasksUntilIdle();
607 manager()->GetApps(&apps); 607 manager()->GetApps(&apps);
608 ASSERT_EQ(0u, apps.size()); 608 ASSERT_EQ(0u, apps.size());
609 // Verify both v1 and v2 crx files are removed. 609 // Verify both v1 and v2 crx files are removed.
610 EXPECT_FALSE(base::PathExists(v1_crx_path)); 610 EXPECT_FALSE(base::PathExists(v1_crx_path));
611 EXPECT_FALSE(base::PathExists(v2_crx_path)); 611 EXPECT_FALSE(base::PathExists(v2_crx_path));
612 EXPECT_FALSE(GetCachedCrx(kTestLocalFsKioskApp, &v2_crx_path, &version)); 612 EXPECT_FALSE(GetCachedCrx(kTestLocalFsKioskApp, &v2_crx_path, &version));
613 } 613 }
614 614
615 IN_PROC_BROWSER_TEST_F(KioskAppManagerTest, EnableConsumerKiosk) { 615 IN_PROC_BROWSER_TEST_F(KioskAppManagerTest, EnableConsumerKiosk) {
616 scoped_ptr<KioskAppManager::ConsumerKioskAutoLaunchStatus> status( 616 scoped_ptr<KioskAppManager::ConsumerKioskAutoLaunchStatus> status(
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 manager()->GetConsumerKioskAutoLaunchStatus( 683 manager()->GetConsumerKioskAutoLaunchStatus(
684 base::Bind(&ConsumerKioskAutoLaunchStatusCheck, 684 base::Bind(&ConsumerKioskAutoLaunchStatusCheck,
685 status.get(), 685 status.get(),
686 runner3->QuitClosure())); 686 runner3->QuitClosure()));
687 runner3->Run(); 687 runner3->Run();
688 EXPECT_EQ(*status.get(), 688 EXPECT_EQ(*status.get(),
689 KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_DISABLED); 689 KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_DISABLED);
690 } 690 }
691 691
692 } // namespace chromeos 692 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698