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

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

Issue 2479633003: Makes the component installers return a Result instead of a bool. (Closed)
Patch Set: rebase 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 EXPECT_TRUE(component->installer->Install(manifest_, unpacked_path)); 354 const auto result = component->installer->Install(manifest_, unpacked_path);
355 EXPECT_EQ(0, result.error);
356 EXPECT_EQ(0, result.extended_error);
355 357
356 observer.Wait(); 358 observer.Wait();
357 EXPECT_EQ(whitelist_path_.value(), observer.whitelist_path().value()); 359 EXPECT_EQ(whitelist_path_.value(), observer.whitelist_path().value());
358 EXPECT_EQ(large_icon_path_.value(), observer.large_icon_path().value()); 360 EXPECT_EQ(large_icon_path_.value(), observer.large_icon_path().value());
359 361
360 std::string whitelist_contents; 362 std::string whitelist_contents;
361 ASSERT_TRUE(base::ReadFileToString(whitelist_path_, &whitelist_contents)); 363 ASSERT_TRUE(base::ReadFileToString(whitelist_path_, &whitelist_contents));
362 364
363 // The actual file contents don't have to be equal, but the parsed values 365 // The actual file contents don't have to be equal, but the parsed values
364 // should be. 366 // should be.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 // but it exercises a different code path. 425 // but it exercises a different code path.
424 profile_attributes_storage()->RemoveProfile(GetProfilePath(kOtherClientId)); 426 profile_attributes_storage()->RemoveProfile(GetProfilePath(kOtherClientId));
425 run_loop.RunUntilIdle(); 427 run_loop.RunUntilIdle();
426 } 428 }
427 EXPECT_FALSE(component_update_service_.registered_component()); 429 EXPECT_FALSE(component_update_service_.registered_component());
428 EXPECT_FALSE(base::DirectoryExists(whitelist_directory_)); 430 EXPECT_FALSE(base::DirectoryExists(whitelist_directory_));
429 EXPECT_FALSE(base::PathExists(whitelist_path_)); 431 EXPECT_FALSE(base::PathExists(whitelist_path_));
430 } 432 }
431 433
432 } // namespace component_updater 434 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698