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

Side by Side Diff: printing/emf_win_unittest.cc

Issue 11359217: Move scoped_temp_dir from base to base/files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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_fetcher_impl_unittest.cc ('k') | remoting/host/host_key_pair_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) 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
11 #include <string> 11 #include <string>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/file_path.h" 14 #include "base/file_path.h"
15 #include "base/file_util.h" 15 #include "base/file_util.h"
16 #include "base/files/scoped_temp_dir.h"
16 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
17 #include "base/path_service.h" 18 #include "base/path_service.h"
18 #include "base/scoped_temp_dir.h"
19 #include "base/win/scoped_hdc.h" 19 #include "base/win/scoped_hdc.h"
20 #include "printing/printing_context.h" 20 #include "printing/printing_context.h"
21 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
22 #include "ui/gfx/point.h" 22 #include "ui/gfx/point.h"
23 #include "ui/gfx/size.h" 23 #include "ui/gfx/size.h"
24 24
25 namespace { 25 namespace {
26 26
27 // This test is automatically disabled if no printer named "UnitTest Printer" is 27 // This test is automatically disabled if no printer named "UnitTest Printer" is
28 // available. 28 // available.
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // the queue. 162 // the queue.
163 HANDLE printer = NULL; 163 HANDLE printer = NULL;
164 if (::OpenPrinter(L"UnitTest Printer", &printer, NULL)) { 164 if (::OpenPrinter(L"UnitTest Printer", &printer, NULL)) {
165 ::SetJob(printer, job_id, 0, NULL, JOB_CONTROL_DELETE); 165 ::SetJob(printer, job_id, 0, NULL, JOB_CONTROL_DELETE);
166 ClosePrinter(printer); 166 ClosePrinter(printer);
167 } 167 }
168 } 168 }
169 169
170 TEST(EmfTest, FileBackedEmf) { 170 TEST(EmfTest, FileBackedEmf) {
171 // Simplest use case. 171 // Simplest use case.
172 ScopedTempDir scratch_metafile_dir; 172 base::ScopedTempDir scratch_metafile_dir;
173 ASSERT_TRUE(scratch_metafile_dir.CreateUniqueTempDir()); 173 ASSERT_TRUE(scratch_metafile_dir.CreateUniqueTempDir());
174 FilePath metafile_path; 174 FilePath metafile_path;
175 EXPECT_TRUE(file_util::CreateTemporaryFileInDir(scratch_metafile_dir.path(), 175 EXPECT_TRUE(file_util::CreateTemporaryFileInDir(scratch_metafile_dir.path(),
176 &metafile_path)); 176 &metafile_path));
177 uint32 size; 177 uint32 size;
178 std::vector<BYTE> data; 178 std::vector<BYTE> data;
179 { 179 {
180 Emf emf; 180 Emf emf;
181 EXPECT_TRUE(emf.InitToFile(metafile_path)); 181 EXPECT_TRUE(emf.InitToFile(metafile_path));
182 EXPECT_TRUE(emf.context() != NULL); 182 EXPECT_TRUE(emf.context() != NULL);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_fetcher_impl_unittest.cc ('k') | remoting/host/host_key_pair_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698