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

Side by Side Diff: content/common/sandbox_mac_fontloading_unittest.mm

Issue 8589001: Load mac sandbox definitions from resources instead of the bundle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: also remove old bundle gyp code Created 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/mac/scoped_cftyperef.h" 9 #include "base/mac/scoped_cftyperef.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/shared_memory.h" 11 #include "base/shared_memory.h"
12 #include "content/common/mac/font_loader.h" 12 #include "content/common/mac/font_loader.h"
13 #include "content/common/sandbox_mac_unittest_helper.h" 13 #include "content/common/sandbox_mac_unittest_helper.h"
14 #include "grit/content_resources.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 16
16 namespace { 17 namespace {
17 18
18 using sandboxtest::MacSandboxTest; 19 using sandboxtest::MacSandboxTest;
19 using sandbox::Sandbox; 20 using sandbox::Sandbox;
20 21
21 class FontLoadingTestCase : public sandboxtest::MacSandboxTestCase { 22 class FontLoadingTestCase : public sandboxtest::MacSandboxTestCase {
22 public: 23 public:
23 FontLoadingTestCase() : font_data_length_(-1) {} 24 FontLoadingTestCase() : font_data_length_(-1) {}
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 uint32 font_id; 115 uint32 font_id;
115 NSFont* srcFont = [NSFont fontWithName:@"Geeza Pro" size:16.0]; 116 NSFont* srcFont = [NSFont fontWithName:@"Geeza Pro" size:16.0];
116 EXPECT_TRUE(FontLoader::LoadFontIntoBuffer(srcFont, 117 EXPECT_TRUE(FontLoader::LoadFontIntoBuffer(srcFont,
117 &font_data, &font_data_size, &font_id)); 118 &font_data, &font_data_size, &font_id));
118 EXPECT_GT(font_data_size, 0U); 119 EXPECT_GT(font_data_size, 0U);
119 EXPECT_GT(font_id, 0U); 120 EXPECT_GT(font_id, 0U);
120 121
121 file_util::WriteFileDescriptor(fileno(temp_file), 122 file_util::WriteFileDescriptor(fileno(temp_file),
122 static_cast<const char *>(font_data.memory()), font_data_size); 123 static_cast<const char *>(font_data.memory()), font_data_size);
123 124
124 ASSERT_TRUE(RunTestInSandbox(Sandbox::SANDBOX_TYPE_RENDERER, 125 ASSERT_TRUE(RunTestInSandbox(IDR_RENDERER_SANDBOX_DEFINITION,
125 "FontLoadingTestCase", temp_file_path.value().c_str())); 126 "FontLoadingTestCase", temp_file_path.value().c_str()));
126 temp_file_closer.reset(); 127 temp_file_closer.reset();
127 ASSERT_TRUE(file_util::Delete(temp_file_path, false)); 128 ASSERT_TRUE(file_util::Delete(temp_file_path, false));
128 } 129 }
129 130
130 } // namespace 131 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698