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

Side by Side Diff: src/platform/update_engine/delta_diff_generator_unittest.cc

Issue 467051: AU: Use Omaha ID rather than MAC address in delta updater (Closed)
Patch Set: fixes for review Created 11 years 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
« no previous file with comments | « no previous file | src/platform/update_engine/install_action_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 <sys/types.h> 5 #include <sys/types.h>
6 #include <sys/stat.h> 6 #include <sys/stat.h>
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <unistd.h> 8 #include <unistd.h>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 EXPECT_EQ(0, System(StringPrintf("rm -f '%s/dir/subdir/fifo'", base_c))); 76 EXPECT_EQ(0, System(StringPrintf("rm -f '%s/dir/subdir/fifo'", base_c)));
77 EXPECT_EQ(0, System(StringPrintf("mkfifo '%s/dir/subdir/fifo'", base_c))); 77 EXPECT_EQ(0, System(StringPrintf("mkfifo '%s/dir/subdir/fifo'", base_c)));
78 EXPECT_EQ(0, System(StringPrintf("ln -f -s /target '%s/dir/subdir/link'", 78 EXPECT_EQ(0, System(StringPrintf("ln -f -s /target '%s/dir/subdir/link'",
79 base_c))); 79 base_c)));
80 EXPECT_EQ(0, System(StringPrintf("rm -f '%s/hard_link'", base_c))); 80 EXPECT_EQ(0, System(StringPrintf("rm -f '%s/hard_link'", base_c)));
81 EXPECT_EQ(0, System(StringPrintf("ln '%s/hi' '%s/hard_link'", 81 EXPECT_EQ(0, System(StringPrintf("ln '%s/hi' '%s/hard_link'",
82 base_c, base_c))); 82 base_c, base_c)));
83 EXPECT_EQ(0, System(StringPrintf( 83 EXPECT_EQ(0, System(StringPrintf(
84 "ln -f -s '%s' '%s/compress_link'", kWellCompressingFilename, base_c))); 84 "ln -f -s '%s' '%s/compress_link'", kWellCompressingFilename, base_c)));
85 85
86 // Things that will encode differently: 86 // Things that will encode differently:
87 EXPECT_EQ(0, System(StringPrintf("mkdir -p '%s/encoding'", base_c))); 87 EXPECT_EQ(0, System(StringPrintf("mkdir -p '%s/encoding'", base_c)));
88 EXPECT_EQ(0, System(StringPrintf("echo nochange > '%s/encoding/nochange'", 88 EXPECT_EQ(0, System(StringPrintf("echo nochange > '%s/encoding/nochange'",
89 base_c))); 89 base_c)));
90 EXPECT_EQ(0, System(StringPrintf("echo -n > '%s/encoding/onebyte'", base_c))); 90 EXPECT_EQ(0, System(StringPrintf("echo -n > '%s/encoding/onebyte'", base_c)));
91 EXPECT_EQ(0, System(StringPrintf("echo -n > '%s/encoding/long_new'", 91 EXPECT_EQ(0, System(StringPrintf("echo -n > '%s/encoding/long_new'",
92 base_c))); 92 base_c)));
93 // Random 1 MiB byte length file 93 // Random 1 MiB byte length file
94 EXPECT_TRUE(WriteFile((base + 94 EXPECT_TRUE(utils::WriteFile((base +
95 "/encoding/long_small_change").c_str(), 95 "/encoding/long_small_change").c_str(),
96 reinterpret_cast<const char*>(kRandomString), 96 reinterpret_cast<const char*>(kRandomString),
97 sizeof(kRandomString))); 97 sizeof(kRandomString)));
98 } 98 }
99 // base points to a folder that was passed to GenerateFilesAtPath(). 99 // base points to a folder that was passed to GenerateFilesAtPath().
100 // This edits some, so that one can make a diff from the original data 100 // This edits some, so that one can make a diff from the original data
101 // and the edited data. 101 // and the edited data.
102 void EditFilesAtPath(const string& base) { 102 void EditFilesAtPath(const string& base) {
103 CHECK_EQ(0, System(string("echo hello > ") + base + "/dir/hello")); 103 CHECK_EQ(0, System(string("echo hello > ") + base + "/dir/hello"));
104 CHECK_EQ(0, System(string("echo -n > ") + base + "/dir/newempty")); 104 CHECK_EQ(0, System(string("echo -n > ") + base + "/dir/newempty"));
105 CHECK_EQ(0, System(string("echo newhi > ") + base + "/hi")); 105 CHECK_EQ(0, System(string("echo newhi > ") + base + "/hi"));
106 CHECK_EQ(0, System(string("echo -n h >> ") + base + 106 CHECK_EQ(0, System(string("echo -n h >> ") + base +
107 "/encoding/onebyte")); 107 "/encoding/onebyte"));
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 { 922 {
923 vector<char> data(14); 923 vector<char> data(14);
924 memcpy(&data[0], "CrAU\0\0\0\0\0\0\0\x0cxx", 12); 924 memcpy(&data[0], "CrAU\0\0\0\0\0\0\0\x0cxx", 12);
925 WriteFileVector("diff-gen-test/baddelta", data); 925 WriteFileVector("diff-gen-test/baddelta", data);
926 DeltaDiffParser parser("diff-gen-test/baddelta"); 926 DeltaDiffParser parser("diff-gen-test/baddelta");
927 EXPECT_FALSE(parser.valid()); 927 EXPECT_FALSE(parser.valid());
928 } 928 }
929 } 929 }
930 930
931 } // namespace chromeos_update_engine 931 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « no previous file | src/platform/update_engine/install_action_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698