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

Side by Side Diff: chrome/browser/component_updater/supervised_user_whitelist_installer_unittest.cc

Issue 2483513002: Revert of Makes the component installers return a Result instead of a bool. (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 installer_->RegisterWhitelist(kOtherClientId, kCrxId, kName); 344 installer_->RegisterWhitelist(kOtherClientId, kCrxId, kName);
345 345
346 base::ScopedTempDir temp_dir; 346 base::ScopedTempDir temp_dir;
347 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 347 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
348 base::FilePath unpacked_path = temp_dir.GetPath(); 348 base::FilePath unpacked_path = temp_dir.GetPath();
349 ASSERT_NO_FATAL_FAILURE(PrepareWhitelistDirectory(unpacked_path)); 349 ASSERT_NO_FATAL_FAILURE(PrepareWhitelistDirectory(unpacked_path));
350 350
351 const CrxComponent* component = 351 const CrxComponent* component =
352 component_update_service_.registered_component(); 352 component_update_service_.registered_component();
353 ASSERT_TRUE(component); 353 ASSERT_TRUE(component);
354 const auto result = component->installer->Install(manifest_, unpacked_path); 354 EXPECT_TRUE(component->installer->Install(manifest_, unpacked_path));
355 EXPECT_EQ(0, result.error);
356 EXPECT_EQ(0, result.extended_error);
357 355
358 observer.Wait(); 356 observer.Wait();
359 EXPECT_EQ(whitelist_path_.value(), observer.whitelist_path().value()); 357 EXPECT_EQ(whitelist_path_.value(), observer.whitelist_path().value());
360 EXPECT_EQ(large_icon_path_.value(), observer.large_icon_path().value()); 358 EXPECT_EQ(large_icon_path_.value(), observer.large_icon_path().value());
361 359
362 std::string whitelist_contents; 360 std::string whitelist_contents;
363 ASSERT_TRUE(base::ReadFileToString(whitelist_path_, &whitelist_contents)); 361 ASSERT_TRUE(base::ReadFileToString(whitelist_path_, &whitelist_contents));
364 362
365 // The actual file contents don't have to be equal, but the parsed values 363 // The actual file contents don't have to be equal, but the parsed values
366 // should be. 364 // should be.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 // but it exercises a different code path. 423 // but it exercises a different code path.
426 profile_attributes_storage()->RemoveProfile(GetProfilePath(kOtherClientId)); 424 profile_attributes_storage()->RemoveProfile(GetProfilePath(kOtherClientId));
427 run_loop.RunUntilIdle(); 425 run_loop.RunUntilIdle();
428 } 426 }
429 EXPECT_FALSE(component_update_service_.registered_component()); 427 EXPECT_FALSE(component_update_service_.registered_component());
430 EXPECT_FALSE(base::DirectoryExists(whitelist_directory_)); 428 EXPECT_FALSE(base::DirectoryExists(whitelist_directory_));
431 EXPECT_FALSE(base::PathExists(whitelist_path_)); 429 EXPECT_FALSE(base::PathExists(whitelist_path_));
432 } 430 }
433 431
434 } // namespace component_updater 432 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698