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 #include "ppapi/tests/test_pdf.h" | 5 #include "ppapi/tests/test_pdf.h" |
6 | 6 |
7 #include "ppapi/c/private/ppb_pdf.h" | 7 #include "ppapi/c/private/ppb_pdf.h" |
8 #include "ppapi/cpp/image_data.h" | 8 #include "ppapi/cpp/image_data.h" |
9 #include "ppapi/cpp/point.h" | 9 #include "ppapi/cpp/point.h" |
10 #include "ppapi/cpp/private/pdf.h" | 10 #include "ppapi/cpp/private/pdf.h" |
11 #include "ppapi/cpp/var.h" | 11 #include "ppapi/cpp/var.h" |
12 #include "ppapi/tests/testing_instance.h" | 12 #include "ppapi/tests/testing_instance.h" |
13 | 13 |
14 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | |
15 #include "gin/public/isolate_holder.h" | |
16 #endif | |
17 | |
18 REGISTER_TEST_CASE(PDF); | 14 REGISTER_TEST_CASE(PDF); |
19 | 15 |
20 TestPDF::TestPDF(TestingInstance* instance) | 16 TestPDF::TestPDF(TestingInstance* instance) |
21 : TestCase(instance) { | 17 : TestCase(instance) { |
22 } | 18 } |
23 | 19 |
24 void TestPDF::RunTests(const std::string& filter) { | 20 void TestPDF::RunTests(const std::string& filter) { |
25 RUN_TEST(GetLocalizedString, filter); | 21 RUN_TEST(GetLocalizedString, filter); |
26 RUN_TEST(GetResourceImage, filter); | 22 RUN_TEST(GetResourceImage, filter); |
27 RUN_TEST(GetV8ExternalSnapshotData, filter); | 23 RUN_TEST(GetV8ExternalSnapshotData, filter); |
(...skipping 20 matching lines...) Expand all Loading... |
48 } | 44 } |
49 } | 45 } |
50 PASS(); | 46 PASS(); |
51 } | 47 } |
52 | 48 |
53 std::string TestPDF::TestGetV8ExternalSnapshotData() { | 49 std::string TestPDF::TestGetV8ExternalSnapshotData() { |
54 const char* natives_data; | 50 const char* natives_data; |
55 const char* snapshot_data; | 51 const char* snapshot_data; |
56 int natives_size; | 52 int natives_size; |
57 int snapshot_size; | 53 int snapshot_size; |
58 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 54 |
59 bool loaded_ok = gin::IsolateHolder::LoadV8Snapshot(); | |
60 ASSERT_TRUE(loaded_ok); | |
61 pp::PDF::GetV8ExternalSnapshotData(instance_, &natives_data, &natives_size, | 55 pp::PDF::GetV8ExternalSnapshotData(instance_, &natives_data, &natives_size, |
62 &snapshot_data, &snapshot_size); | 56 &snapshot_data, &snapshot_size); |
| 57 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
63 ASSERT_NE(natives_data, (char*) (NULL)); | 58 ASSERT_NE(natives_data, (char*) (NULL)); |
64 ASSERT_NE(natives_size, 0); | 59 ASSERT_NE(natives_size, 0); |
65 ASSERT_NE(snapshot_data, (char*) (NULL)); | 60 ASSERT_NE(snapshot_data, (char*) (NULL)); |
66 ASSERT_NE(snapshot_size, 0); | 61 ASSERT_NE(snapshot_size, 0); |
67 #else | 62 #else |
68 pp::PDF::GetV8ExternalSnapshotData(instance_, &natives_data, &natives_size, | |
69 &snapshot_data, &snapshot_size); | |
70 ASSERT_EQ(natives_data, (char*) (NULL)); | 63 ASSERT_EQ(natives_data, (char*) (NULL)); |
71 ASSERT_EQ(natives_size, 0); | 64 ASSERT_EQ(natives_size, 0); |
72 ASSERT_EQ(snapshot_data, (char*) (NULL)); | 65 ASSERT_EQ(snapshot_data, (char*) (NULL)); |
73 ASSERT_EQ(snapshot_size, 0); | 66 ASSERT_EQ(snapshot_size, 0); |
74 #endif | 67 #endif |
75 PASS(); | 68 PASS(); |
76 } | 69 } |
OLD | NEW |