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 REGISTER_TEST_CASE(PDF); | 14 REGISTER_TEST_CASE(PDF); |
15 | 15 |
16 TestPDF::TestPDF(TestingInstance* instance) | 16 TestPDF::TestPDF(TestingInstance* instance) |
17 : TestCase(instance) { | 17 : TestCase(instance) { |
18 } | 18 } |
19 | 19 |
20 void TestPDF::RunTests(const std::string& filter) { | 20 void TestPDF::RunTests(const std::string& filter) { |
21 RUN_TEST(GetLocalizedString, filter); | |
22 RUN_TEST(GetV8ExternalSnapshotData, filter); | 21 RUN_TEST(GetV8ExternalSnapshotData, filter); |
23 } | 22 } |
24 | 23 |
25 std::string TestPDF::TestGetLocalizedString() { | |
26 pp::Var string = pp::PDF::GetLocalizedString(instance_, | |
27 PP_RESOURCESTRING_PDFGETPASSWORD); | |
28 ASSERT_TRUE(string.is_string()); | |
29 ASSERT_EQ("This document is password protected. Please enter a password.", | |
30 string.AsString()); | |
31 PASS(); | |
32 } | |
33 | |
34 std::string TestPDF::TestGetV8ExternalSnapshotData() { | 24 std::string TestPDF::TestGetV8ExternalSnapshotData() { |
35 const char* natives_data; | 25 const char* natives_data; |
36 const char* snapshot_data; | 26 const char* snapshot_data; |
37 int natives_size; | 27 int natives_size; |
38 int snapshot_size; | 28 int snapshot_size; |
39 | 29 |
40 pp::PDF::GetV8ExternalSnapshotData(instance_, &natives_data, &natives_size, | 30 pp::PDF::GetV8ExternalSnapshotData(instance_, &natives_data, &natives_size, |
41 &snapshot_data, &snapshot_size); | 31 &snapshot_data, &snapshot_size); |
42 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 32 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
43 ASSERT_NE(natives_data, (char*) (NULL)); | 33 ASSERT_NE(natives_data, (char*) (NULL)); |
44 ASSERT_NE(natives_size, 0); | 34 ASSERT_NE(natives_size, 0); |
45 ASSERT_NE(snapshot_data, (char*) (NULL)); | 35 ASSERT_NE(snapshot_data, (char*) (NULL)); |
46 ASSERT_NE(snapshot_size, 0); | 36 ASSERT_NE(snapshot_size, 0); |
47 #else | 37 #else |
48 ASSERT_EQ(natives_data, (char*) (NULL)); | 38 ASSERT_EQ(natives_data, (char*) (NULL)); |
49 ASSERT_EQ(natives_size, 0); | 39 ASSERT_EQ(natives_size, 0); |
50 ASSERT_EQ(snapshot_data, (char*) (NULL)); | 40 ASSERT_EQ(snapshot_data, (char*) (NULL)); |
51 ASSERT_EQ(snapshot_size, 0); | 41 ASSERT_EQ(snapshot_size, 0); |
52 #endif | 42 #endif |
53 PASS(); | 43 PASS(); |
54 } | 44 } |
OLD | NEW |