OLD | NEW |
1 // Copyright (c) 2015 PDFium Authors. All rights reserved. | 1 // Copyright (c) 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 "embedder_test.h" | 5 #include "embedder_test.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 default_delegate_ = new EmbedderTestDefaultDelegate(); | 186 default_delegate_ = new EmbedderTestDefaultDelegate(); |
187 delegate_ = default_delegate_; | 187 delegate_ = default_delegate_; |
188 } | 188 } |
189 | 189 |
190 EmbedderTest::~EmbedderTest() { | 190 EmbedderTest::~EmbedderTest() { |
191 delete default_delegate_; | 191 delete default_delegate_; |
192 } | 192 } |
193 | 193 |
194 void EmbedderTest::SetUp() { | 194 void EmbedderTest::SetUp() { |
195 v8::V8::InitializeICU(); | 195 v8::V8::InitializeICU(); |
| 196 // By enabling predicatble mode, V8 won't post any background tasks. |
| 197 const char predictable_flag[] = "--predictable"; |
| 198 v8::V8::SetFlagsFromString(predictable_flag, strlen(predictable_flag)); |
196 | 199 |
197 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 200 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
198 ASSERT_TRUE(GetExternalData(g_exe_path_, "natives_blob.bin", &natives_)); | 201 ASSERT_TRUE(GetExternalData(g_exe_path_, "natives_blob.bin", &natives_)); |
199 ASSERT_TRUE(GetExternalData(g_exe_path_, "snapshot_blob.bin", &snapshot_)); | 202 ASSERT_TRUE(GetExternalData(g_exe_path_, "snapshot_blob.bin", &snapshot_)); |
200 v8::V8::SetNativesDataBlob(&natives_); | 203 v8::V8::SetNativesDataBlob(&natives_); |
201 v8::V8::SetSnapshotDataBlob(&snapshot_); | 204 v8::V8::SetSnapshotDataBlob(&snapshot_); |
202 #endif // V8_USE_EXTERNAL_STARTUP_DATA | 205 #endif // V8_USE_EXTERNAL_STARTUP_DATA |
203 | 206 |
204 FPDF_InitLibrary(); | 207 FPDF_InitLibrary(); |
205 | 208 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 } | 334 } |
332 | 335 |
333 // Can't use gtest-provided main since we need to stash the path to the | 336 // Can't use gtest-provided main since we need to stash the path to the |
334 // executable in order to find the external V8 binary data files. | 337 // executable in order to find the external V8 binary data files. |
335 int main(int argc, char** argv) { | 338 int main(int argc, char** argv) { |
336 g_exe_path_ = argv[0]; | 339 g_exe_path_ = argv[0]; |
337 testing::InitGoogleTest(&argc, argv); | 340 testing::InitGoogleTest(&argc, argv); |
338 testing::InitGoogleMock(&argc, argv); | 341 testing::InitGoogleMock(&argc, argv); |
339 return RUN_ALL_TESTS(); | 342 return RUN_ALL_TESTS(); |
340 } | 343 } |
OLD | NEW |