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

Side by Side Diff: chrome/browser/component_updater/test/component_patcher_unittest.cc

Issue 19052005: Move PathIsWritable, DirectoryExists, ContentsEqual, and TextContentsEqual to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 "base/compiler_specific.h" 5 #include "base/compiler_specific.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 scoped_ptr<DeltaUpdateOp> op(new DeltaUpdateOpCreate()); 78 scoped_ptr<DeltaUpdateOp> op(new DeltaUpdateOpCreate());
79 ComponentUnpacker::Error result = op->Run(command_args.get(), 79 ComponentUnpacker::Error result = op->Run(command_args.get(),
80 input_dir_.path(), 80 input_dir_.path(),
81 unpack_dir_.path(), 81 unpack_dir_.path(),
82 patcher_.get(), 82 patcher_.get(),
83 NULL, 83 NULL,
84 &error); 84 &error);
85 85
86 EXPECT_EQ(ComponentUnpacker::kNone, result); 86 EXPECT_EQ(ComponentUnpacker::kNone, result);
87 EXPECT_EQ(0, error); 87 EXPECT_EQ(0, error);
88 EXPECT_TRUE(file_util::ContentsEqual( 88 EXPECT_TRUE(base::ContentsEqual(
89 unpack_dir_.path().Append(FILE_PATH_LITERAL("output.bin")), 89 unpack_dir_.path().Append(FILE_PATH_LITERAL("output.bin")),
90 test_file("binary_output.bin"))); 90 test_file("binary_output.bin")));
91 } 91 }
92 92
93 // Verify that a 'copy' delta update operation works correctly. 93 // Verify that a 'copy' delta update operation works correctly.
94 TEST_F(ComponentPatcherOperationTest, CheckCopyOperation) { 94 TEST_F(ComponentPatcherOperationTest, CheckCopyOperation) {
95 EXPECT_TRUE(base::CopyFile( 95 EXPECT_TRUE(base::CopyFile(
96 test_file("binary_output.bin"), 96 test_file("binary_output.bin"),
97 installed_dir_.path().Append(FILE_PATH_LITERAL("binary_output.bin")))); 97 installed_dir_.path().Append(FILE_PATH_LITERAL("binary_output.bin"))));
98 98
99 scoped_ptr<base::DictionaryValue> command_args(new base::DictionaryValue()); 99 scoped_ptr<base::DictionaryValue> command_args(new base::DictionaryValue());
100 command_args->SetString("output", "output.bin"); 100 command_args->SetString("output", "output.bin");
101 command_args->SetString("sha256", binary_output_hash); 101 command_args->SetString("sha256", binary_output_hash);
102 command_args->SetString("op", "copy"); 102 command_args->SetString("op", "copy");
103 command_args->SetString("input", "binary_output.bin"); 103 command_args->SetString("input", "binary_output.bin");
104 104
105 int error = 0; 105 int error = 0;
106 scoped_ptr<DeltaUpdateOp> op(new DeltaUpdateOpCopy()); 106 scoped_ptr<DeltaUpdateOp> op(new DeltaUpdateOpCopy());
107 ComponentUnpacker::Error result = op->Run(command_args.get(), 107 ComponentUnpacker::Error result = op->Run(command_args.get(),
108 input_dir_.path(), 108 input_dir_.path(),
109 unpack_dir_.path(), 109 unpack_dir_.path(),
110 patcher_.get(), 110 patcher_.get(),
111 installer_.get(), 111 installer_.get(),
112 &error); 112 &error);
113 EXPECT_EQ(ComponentUnpacker::kNone, result); 113 EXPECT_EQ(ComponentUnpacker::kNone, result);
114 EXPECT_EQ(0, error); 114 EXPECT_EQ(0, error);
115 EXPECT_TRUE(file_util::ContentsEqual( 115 EXPECT_TRUE(base::ContentsEqual(
116 unpack_dir_.path().Append(FILE_PATH_LITERAL("output.bin")), 116 unpack_dir_.path().Append(FILE_PATH_LITERAL("output.bin")),
117 test_file("binary_output.bin"))); 117 test_file("binary_output.bin")));
118 } 118 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698