OLD | NEW |
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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/files/scoped_file.h" | 8 #include "base/files/scoped_file.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/shared_memory.h" | 12 #include "base/memory/shared_memory.h" |
13 #include "content/common/mac/font_descriptor.h" | 13 #include "content/common/mac/font_descriptor.h" |
14 #include "content/common/mac/font_loader.h" | 14 #include "content/common/mac/font_loader.h" |
15 #include "content/common/sandbox_mac_unittest_helper.h" | 15 #include "content/common/sandbox_mac_unittest_helper.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class FontLoadingTestCase : public MacSandboxTestCase { | 20 class FontLoadingTestCase : public MacSandboxTestCase { |
21 public: | 21 public: |
22 FontLoadingTestCase() : font_data_length_(-1) {} | 22 FontLoadingTestCase() : font_data_length_(-1) {} |
23 virtual bool BeforeSandboxInit() OVERRIDE; | 23 virtual bool BeforeSandboxInit() override; |
24 virtual bool SandboxedTest() OVERRIDE; | 24 virtual bool SandboxedTest() override; |
25 private: | 25 private: |
26 scoped_ptr<base::SharedMemory> font_shmem_; | 26 scoped_ptr<base::SharedMemory> font_shmem_; |
27 size_t font_data_length_; | 27 size_t font_data_length_; |
28 }; | 28 }; |
29 REGISTER_SANDBOX_TEST_CASE(FontLoadingTestCase); | 29 REGISTER_SANDBOX_TEST_CASE(FontLoadingTestCase); |
30 | 30 |
31 | 31 |
32 // Load raw font data into shared memory object. | 32 // Load raw font data into shared memory object. |
33 bool FontLoadingTestCase::BeforeSandboxInit() { | 33 bool FontLoadingTestCase::BeforeSandboxInit() { |
34 std::string font_data; | 34 std::string font_data; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 static_cast<const char *>(result.font_data.memory()), | 119 static_cast<const char *>(result.font_data.memory()), |
120 result.font_data_size); | 120 result.font_data_size); |
121 | 121 |
122 ASSERT_TRUE(RunTestInSandbox(SANDBOX_TYPE_RENDERER, | 122 ASSERT_TRUE(RunTestInSandbox(SANDBOX_TYPE_RENDERER, |
123 "FontLoadingTestCase", temp_file_path.value().c_str())); | 123 "FontLoadingTestCase", temp_file_path.value().c_str())); |
124 temp_file_closer.reset(); | 124 temp_file_closer.reset(); |
125 ASSERT_TRUE(base::DeleteFile(temp_file_path, false)); | 125 ASSERT_TRUE(base::DeleteFile(temp_file_path, false)); |
126 } | 126 } |
127 | 127 |
128 } // namespace content | 128 } // namespace content |
OLD | NEW |