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

Side by Side Diff: testing/test_support.cpp

Issue 1424743006: Make JS app.setTimeOut() work again. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 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
OLDNEW
1 // Copyright 2015 PDFium Authors. All rights reserved. 1 // Copyright 2015 PDFium 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 "test_support.h" 5 #include "test_support.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #ifdef _WIN32 10 #ifdef _WIN32
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 (void)fclose(file); 91 (void)fclose(file);
92 if (bytes_read != file_length) { 92 if (bytes_read != file_length) {
93 fprintf(stderr, "Failed to read: %s\n", filename); 93 fprintf(stderr, "Failed to read: %s\n", filename);
94 free(buffer); 94 free(buffer);
95 return nullptr; 95 return nullptr;
96 } 96 }
97 *retlen = bytes_read; 97 *retlen = bytes_read;
98 return buffer; 98 return buffer;
99 } 99 }
100 100
101 std::wstring GetWideString(FPDF_WIDESTRING wstr) {
102 if (!wstr)
103 return nullptr;
104
105 size_t characters = 0;
106 while (wstr[characters])
107 ++characters;
108
109 std::wstring platform_string(characters, L'\0');
110 for (size_t i = 0; i < characters + 1; ++i) {
111 const unsigned char* ptr = reinterpret_cast<const unsigned char*>(&wstr[i]);
112 platform_string[i] = ptr[0] + 256 * ptr[1];
113 }
114 return platform_string;
115 }
116
101 #ifdef PDF_ENABLE_V8 117 #ifdef PDF_ENABLE_V8
102 #ifdef V8_USE_EXTERNAL_STARTUP_DATA 118 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
103 bool InitializeV8ForPDFium(const std::string& exe_path, 119 bool InitializeV8ForPDFium(const std::string& exe_path,
104 const std::string& bin_dir, 120 const std::string& bin_dir,
105 v8::StartupData* natives_blob, 121 v8::StartupData* natives_blob,
106 v8::StartupData* snapshot_blob, 122 v8::StartupData* snapshot_blob,
107 v8::Platform** platform) { 123 v8::Platform** platform) {
108 InitializeV8Common(platform); 124 InitializeV8Common(platform);
109 if (!GetExternalData(exe_path, bin_dir, "natives_blob.bin", natives_blob)) 125 if (!GetExternalData(exe_path, bin_dir, "natives_blob.bin", natives_blob))
110 return false; 126 return false;
(...skipping 20 matching lines...) Expand all
131 unsigned long pos, 147 unsigned long pos,
132 unsigned char* pBuf, 148 unsigned char* pBuf,
133 unsigned long size) { 149 unsigned long size) {
134 TestLoader* pLoader = static_cast<TestLoader*>(param); 150 TestLoader* pLoader = static_cast<TestLoader*>(param);
135 if (pos + size < pos || pos + size > pLoader->m_Len) 151 if (pos + size < pos || pos + size > pLoader->m_Len)
136 return 0; 152 return 0;
137 153
138 memcpy(pBuf, pLoader->m_pBuf + pos, size); 154 memcpy(pBuf, pLoader->m_pBuf + pos, size);
139 return 1; 155 return 1;
140 } 156 }
OLDNEW
« testing/embedder_test_timer_handling_delegate.h ('K') | « testing/test_support.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698