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

Side by Side Diff: ppapi/tests/test_pdf.cc

Issue 13004012: Implement the host side of the PPB_PDF proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 8 months 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/tests/test_pdf.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ppapi/tests/test_pdf.h"
6
7 #include "ppapi/c/private/ppb_pdf.h"
8 #include "ppapi/cpp/image_data.h"
9 #include "ppapi/cpp/point.h"
10 #include "ppapi/cpp/private/pdf.h"
11 #include "ppapi/cpp/var.h"
12 #include "ppapi/tests/testing_instance.h"
13
14 REGISTER_TEST_CASE(PDF);
15
16 TestPDF::TestPDF(TestingInstance* instance)
17 : TestCase(instance) {
18 }
19
20 void TestPDF::RunTests(const std::string& filter) {
21 RUN_TEST(GetLocalizedString, filter);
22 RUN_TEST(GetResourceImage, filter);
23 }
24
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::TestGetResourceImage() {
35 pp::ImageData data =
36 pp::PDF::GetResourceImage(instance_, PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN);
37 ASSERT_EQ(43, data.size().width());
38 ASSERT_EQ(42, data.size().height());
39 for (int i = 0; i < data.size().width(); ++i) {
40 for (int j = 0; j < data.size().height(); ++j) {
41 pp::Point point(i, j);
42 ASSERT_NE(*data.GetAddr32(point), 0);
43 }
44 }
45 PASS();
46 }
OLDNEW
« no previous file with comments | « ppapi/tests/test_pdf.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698