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

Side by Side Diff: printing/emf_win_unittest.cc

Issue 102873002: Move GetFileSize, NormalizeFilePath to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « net/url_request/url_request_unittest.cc ('k') | sql/connection.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "printing/emf_win.h" 5 #include "printing/emf_win.h"
6 6
7 // For quick access. 7 // For quick access.
8 #include <wingdi.h> 8 #include <wingdi.h>
9 #include <winspool.h> 9 #include <winspool.h>
10 10
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 EXPECT_TRUE(emf.context() != NULL); 182 EXPECT_TRUE(emf.context() != NULL);
183 // An empty EMF is invalid, so we put at least a rectangle in it. 183 // An empty EMF is invalid, so we put at least a rectangle in it.
184 ::Rectangle(emf.context(), 10, 10, 190, 190); 184 ::Rectangle(emf.context(), 10, 10, 190, 190);
185 EXPECT_TRUE(emf.FinishDocument()); 185 EXPECT_TRUE(emf.FinishDocument());
186 size = emf.GetDataSize(); 186 size = emf.GetDataSize();
187 EXPECT_GT(size, EMF_HEADER_SIZE); 187 EXPECT_GT(size, EMF_HEADER_SIZE);
188 EXPECT_TRUE(emf.GetDataAsVector(&data)); 188 EXPECT_TRUE(emf.GetDataAsVector(&data));
189 EXPECT_EQ(data.size(), size); 189 EXPECT_EQ(data.size(), size);
190 } 190 }
191 int64 file_size = 0; 191 int64 file_size = 0;
192 file_util::GetFileSize(metafile_path, &file_size); 192 base::GetFileSize(metafile_path, &file_size);
193 EXPECT_EQ(size, file_size); 193 EXPECT_EQ(size, file_size);
194 194
195 // Playback the data. 195 // Playback the data.
196 HDC hdc = CreateCompatibleDC(NULL); 196 HDC hdc = CreateCompatibleDC(NULL);
197 EXPECT_TRUE(hdc); 197 EXPECT_TRUE(hdc);
198 Emf emf; 198 Emf emf;
199 EXPECT_TRUE(emf.InitFromFile(metafile_path)); 199 EXPECT_TRUE(emf.InitFromFile(metafile_path));
200 RECT output_rect = {0, 0, 10, 10}; 200 RECT output_rect = {0, 0, 10, 10};
201 EXPECT_TRUE(emf.Playback(hdc, &output_rect)); 201 EXPECT_TRUE(emf.Playback(hdc, &output_rect));
202 EXPECT_TRUE(DeleteDC(hdc)); 202 EXPECT_TRUE(DeleteDC(hdc));
(...skipping 18 matching lines...) Expand all
221 EXPECT_EQ(emf.GetPageBounds(1), raster->GetPageBounds(1)); 221 EXPECT_EQ(emf.GetPageBounds(1), raster->GetPageBounds(1));
222 222
223 raster.reset(emf.RasterizeMetafile(16*1024*1024)); 223 raster.reset(emf.RasterizeMetafile(16*1024*1024));
224 // Expected size about 64MB. 224 // Expected size about 64MB.
225 EXPECT_LE(abs(int(raster->GetDataSize()) - 64*1024*1024), 1024*1024); 225 EXPECT_LE(abs(int(raster->GetDataSize()) - 64*1024*1024), 1024*1024);
226 // Bounds should still be the same. 226 // Bounds should still be the same.
227 EXPECT_EQ(emf.GetPageBounds(1), raster->GetPageBounds(1)); 227 EXPECT_EQ(emf.GetPageBounds(1), raster->GetPageBounds(1));
228 } 228 }
229 229
230 } // namespace printing 230 } // namespace printing
OLDNEW
« no previous file with comments | « net/url_request/url_request_unittest.cc ('k') | sql/connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698