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

Side by Side Diff: chrome/test/data/nacl/manifest_file/irt_manifest_file_test.cc

Issue 383063002: NaCl: Fix NaClBrowserTestPnaclNonSfi.IrtManifestFile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
« no previous file with comments | « no previous file | chrome/test/data/nacl/manifest_file/pm_manifest_file_test.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 /* 1 /*
2 * Copyright 2014 The Chromium Authors. All rights reserved. 2 * Copyright 2014 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 // 7 //
8 // Test for resource open before PPAPI initialization. 8 // Test for resource open before PPAPI initialization.
9 // 9 //
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 if (0 != error) { 42 if (0 != error) {
43 printf("Can't open file, error=%d", error); 43 printf("Can't open file, error=%d", error);
44 return "Can't open file"; 44 return "Can't open file";
45 } 45 }
46 46
47 std::string str; 47 std::string str;
48 48
49 char buffer[4096]; 49 char buffer[4096];
50 int len; 50 int len;
51 while ((len = read(desc, buffer, sizeof buffer - 1)) > 0) { 51 while ((len = read(desc, buffer, sizeof buffer - 1)) > 0) {
52 // NB: fgets does not discard the newline nor any carriage return
53 // character before that.
54 //
55 // Note that CR LF is the default end-of-line style for Windows.
56 // Furthermore, when the test_file (input data, which happens to
57 // be the nmf file) is initially created in a change list, the
58 // patch is sent to our try bots as text. This means that when
59 // the file arrives, it has CR LF endings instead of the original
60 // LF line endings. Since the expected or golden data is
61 // (manually) encoded in the HTML file's JavaScript, there will be
62 // a mismatch. After submission, the svn property svn:eol-style
63 // will be set to LF, so a clean check out should have LF and not
64 // CR LF endings, and the tests will pass without CR removal.
65 // However -- and there's always a however in long discourses --
66 // if the nmf file is edited, say, because the test is being
67 // modified, and the modification is being done on a Windows
68 // machine, then it is likely that the editor used by the
69 // programmer will convert the file to CR LF endings. Which,
70 // unfortunatly, implies that the test will mysteriously fail
71 // again.
72 //
73 // To defend against such nonsense, we weaken the test slighty,
74 // and just strip the CR if it is present.
75 int len = strlen(buffer);
76 if (len >= 2 && buffer[len-1] == '\n' && buffer[len-2] == '\r') {
Mark Seaborn 2014/07/11 16:55:18 Removing this makes sense because the expected str
77 buffer[len-2] = '\n';
78 buffer[len-1] = '\0';
79 }
80 // Null terminate. 52 // Null terminate.
81 buffer[len] = 0; 53 buffer[len] = '\0';
82 str += buffer; 54 str += buffer;
83 } 55 }
84 56
85 if (str != "Test File Content") { 57 if (str != "Test File Content") {
86 printf("Wrong file content: \"%s\"\n", str.c_str()); 58 printf("Wrong file content: \"%s\"\n", str.c_str());
87 return "Wrong file content: " + str; 59 return "Wrong file content: " + str;
88 } 60 }
89 61
90 return "Pass"; 62 return "Pass";
91 } 63 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 return new TestModule(); 146 return new TestModule();
175 } 147 }
176 } 148 }
177 149
178 int main() { 150 int main() {
179 result.push_back(LoadManifestSuccess(&__nacl_irt_query)); 151 result.push_back(LoadManifestSuccess(&__nacl_irt_query));
180 result.push_back(LoadManifestNonExistentEntry(&__nacl_irt_query)); 152 result.push_back(LoadManifestNonExistentEntry(&__nacl_irt_query));
181 result.push_back(LoadManifestNonExistentFile(&__nacl_irt_query)); 153 result.push_back(LoadManifestNonExistentFile(&__nacl_irt_query));
182 return PpapiPluginMain(); 154 return PpapiPluginMain();
183 } 155 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/nacl/manifest_file/pm_manifest_file_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698