Skip to content

Commit

Permalink
Add pdf_unittests target.
Browse files Browse the repository at this point in the history
Needs for https://codereview.chromium.org/2349753003/

Review-Url: https://codereview.chromium.org/2453323002
Cr-Commit-Position: refs/heads/master@{#428066}
  • Loading branch information
art-snake authored and Commit bot committed Oct 27, 2016
1 parent 9c7668a commit 0c34926
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pdf/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# found in the LICENSE file.

import("//build/config/features.gni")
import("//testing/test.gni")
import("//third_party/pdfium/pdfium.gni")

assert(enable_pdf)
Expand Down Expand Up @@ -67,3 +68,20 @@ static_library("pdf") {
defines += [ "PDF_ENABLE_XFA" ]
}
}

test("pdf_unittests") {
sources = [
"chunk_stream_unittest.cc",
"run_all_unittests.cc",
]

deps = [
":pdf",
"//base",
"//base/test:test_support",
"//ppapi/c",
"//ppapi/cpp",
"//testing/gmock",
"//testing/gtest",
]
}
17 changes: 17 additions & 0 deletions pdf/chunk_stream_unittest.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "pdf/chunk_stream.h"

#include "testing/gtest/include/gtest/gtest.h"

namespace chrome_pdf {

TEST(ChunkStreamTest, Simple) {
ChunkStream stream;
stream.Preallocate(1000);
EXPECT_FALSE(stream.IsRangeAvailable(100, 500));
}

} // namespace chrome_pdf
24 changes: 24 additions & 0 deletions pdf/run_all_unittests.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/test/launcher/unit_test_launcher.h"
#include "base/test/test_suite.h"

// ppapi_cpp won't link w/o this.
namespace pp {

class Module;

Module* CreateModule() {
return nullptr;
}

} // namespace pp

int main(int argc, char** argv) {
base::TestSuite test_suite(argc, argv);
return base::LaunchUnitTests(
argc, argv,
base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite)));
}

0 comments on commit 0c34926

Please sign in to comment.