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

Side by Side Diff: import/cross/targz_generator_test.cc

Issue 159168: This fixes a number of things that are warnings in the Mac compiler.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: Created 11 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 /* 1 /*
2 * Copyright 2009, Google Inc. 2 * Copyright 2009, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 size_t remaining = write_stream_.GetRemainingByteCount(); 67 size_t remaining = write_stream_.GetRemainingByteCount();
68 EXPECT_TRUE(bytes_to_process <= remaining); 68 EXPECT_TRUE(bytes_to_process <= remaining);
69 69
70 write_stream_.Write(p, bytes_to_process); 70 write_stream_.Write(p, bytes_to_process);
71 71
72 return 0; 72 return 0;
73 } 73 }
74 74
75 // Checks that the data from the reference tar.gz file matches the tar.gz 75 // Checks that the data from the reference tar.gz file matches the tar.gz
76 // stream we just ge5nerated 76 // stream we just ge5nerated
77 void Validate(uint8 *reference_data) { 77 uint8* compressed_data() {
78 uint8 *received_data = compressed_data_; 78 uint8 *received_data = compressed_data_;
79 return received_data;
80 }
79 81
80 // on Windows the platform field is different than our reference file 82 size_t compressed_data_length() {
81 received_data[9] = 3; // Force platform in header to 'UNIX'. 83 return compressed_data_.GetLength();
82
83 EXPECT_EQ(0, memcmp(reference_data,
84 received_data,
85 compressed_data_.GetLength()));
86 } 84 }
87 85
88 #if defined(GENERATE_GOLDEN) 86 #if defined(GENERATE_GOLDEN)
89 char* received_data() { 87 char* received_data() {
90 uint8 *data = compressed_data_; 88 uint8 *data = compressed_data_;
91 data[9] = 3; // Force platform in header to 'UNIX'. 89 data[9] = 3; // Force platform in header to 'UNIX'.
92 return reinterpret_cast<char*>(data); 90 return reinterpret_cast<char*>(data);
93 } 91 }
94 92
95 int received_data_length() { 93 int received_data_length() {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 146
149 #if defined(GENERATE_GOLDEN) 147 #if defined(GENERATE_GOLDEN)
150 std::string new_golden_file = *g_program_path + 148 std::string new_golden_file = *g_program_path +
151 "/archive_files/new_golden_test2.tar.gz"; 149 "/archive_files/new_golden_test2.tar.gz";
152 file_util::WriteFile(UTF8ToFilePath(new_golden_file), 150 file_util::WriteFile(UTF8ToFilePath(new_golden_file),
153 test_client.received_data(), 151 test_client.received_data(),
154 test_client.received_data_length()); 152 test_client.received_data_length());
155 153
156 #endif 154 #endif
157 155
158 test_client.Validate(targz_data); 156 uint8 *received_data = test_client.compressed_data();
157
158 // The platform header in our reference file is set to UNIX, so
159 // force received data to match for all platforms.
160 received_data[9] = 3;
161
162 EXPECT_EQ(0, memcmp(targz_data,
163 received_data,
164 test_client.compressed_data_length()));
159 165
160 free(targz_data); 166 free(targz_data);
161 free(image_data); 167 free(image_data);
162 free(audio_data); 168 free(audio_data);
163 free(shader_data); 169 free(shader_data);
164 } 170 }
165 171
166 } // namespace o3d 172 } // namespace o3d
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698