| 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" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 std::string TestPDF::TestGetLocalizedString() { | 26 std::string TestPDF::TestGetLocalizedString() { |
| 27 pp::Var string = pp::PDF::GetLocalizedString(instance_, | 27 pp::Var string = pp::PDF::GetLocalizedString(instance_, |
| 28 PP_RESOURCESTRING_PDFGETPASSWORD); | 28 PP_RESOURCESTRING_PDFGETPASSWORD); |
| 29 ASSERT_TRUE(string.is_string()); | 29 ASSERT_TRUE(string.is_string()); |
| 30 ASSERT_EQ("This document is password protected. Please enter a password.", | 30 ASSERT_EQ("This document is password protected. Please enter a password.", |
| 31 string.AsString()); | 31 string.AsString()); |
| 32 PASS(); | 32 PASS(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 std::string TestPDF::TestGetResourceImage() { | |
| 36 pp::ImageData data = | |
| 37 pp::PDF::GetResourceImage(instance_, PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN); | |
| 38 ASSERT_EQ(43, data.size().width()); | |
| 39 ASSERT_EQ(42, data.size().height()); | |
| 40 for (int i = 0; i < data.size().width(); ++i) { | |
| 41 for (int j = 0; j < data.size().height(); ++j) { | |
| 42 pp::Point point(i, j); | |
| 43 ASSERT_NE(0, *data.GetAddr32(point)); | |
| 44 } | |
| 45 } | |
| 46 PASS(); | |
| 47 } | |
| 48 | |
| 49 std::string TestPDF::TestGetV8ExternalSnapshotData() { | 35 std::string TestPDF::TestGetV8ExternalSnapshotData() { |
| 50 const char* natives_data; | 36 const char* natives_data; |
| 51 const char* snapshot_data; | 37 const char* snapshot_data; |
| 52 int natives_size; | 38 int natives_size; |
| 53 int snapshot_size; | 39 int snapshot_size; |
| 54 | 40 |
| 55 pp::PDF::GetV8ExternalSnapshotData(instance_, &natives_data, &natives_size, | 41 pp::PDF::GetV8ExternalSnapshotData(instance_, &natives_data, &natives_size, |
| 56 &snapshot_data, &snapshot_size); | 42 &snapshot_data, &snapshot_size); |
| 57 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 43 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 58 ASSERT_NE(natives_data, (char*) (NULL)); | 44 ASSERT_NE(natives_data, (char*) (NULL)); |
| 59 ASSERT_NE(natives_size, 0); | 45 ASSERT_NE(natives_size, 0); |
| 60 ASSERT_NE(snapshot_data, (char*) (NULL)); | 46 ASSERT_NE(snapshot_data, (char*) (NULL)); |
| 61 ASSERT_NE(snapshot_size, 0); | 47 ASSERT_NE(snapshot_size, 0); |
| 62 #else | 48 #else |
| 63 ASSERT_EQ(natives_data, (char*) (NULL)); | 49 ASSERT_EQ(natives_data, (char*) (NULL)); |
| 64 ASSERT_EQ(natives_size, 0); | 50 ASSERT_EQ(natives_size, 0); |
| 65 ASSERT_EQ(snapshot_data, (char*) (NULL)); | 51 ASSERT_EQ(snapshot_data, (char*) (NULL)); |
| 66 ASSERT_EQ(snapshot_size, 0); | 52 ASSERT_EQ(snapshot_size, 0); |
| 67 #endif | 53 #endif |
| 68 PASS(); | 54 PASS(); |
| 69 } | 55 } |
| OLD | NEW |