1// Copyright 2015 PDFium 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
6#include "../../public/fpdf_formfill.h"
7#include "../../testing/embedder_test.h"
8#include "../../testing/embedder_test_mock_delegate.h"
9#include "../../testing/embedder_test_timer_handling_delegate.h"
10#include "testing/gmock/include/gmock/gmock.h"
11#include "testing/gtest/include/gtest/gtest.h"
12
13using testing::_;
14using testing::Return;
15
16class FPDFFormFillEmbeddertest : public EmbedderTest {
17};
18
19TEST_F(FPDFFormFillEmbeddertest, FirstTest) {
20  EmbedderTestMockDelegate mock;
21  EXPECT_CALL(mock, Alert(_, _, _, _)).Times(0);
22  EXPECT_CALL(mock, UnsupportedHandler(_)).Times(0);
23  EXPECT_CALL(mock, SetTimer(_, _)).Times(0);
24  EXPECT_CALL(mock, KillTimer(_)).Times(0);
25  SetDelegate(&mock);
26
27  EXPECT_TRUE(OpenDocument("testing/resources/hello_world.pdf"));
28  FPDF_PAGE page = LoadPage(0);
29  EXPECT_NE(nullptr, page);
30  UnloadPage(page);
31}
32
33TEST_F(FPDFFormFillEmbeddertest, BUG_487928) {
34  EmbedderTestTimerHandlingDelegate delegate;
35  SetDelegate(&delegate);
36
37  EXPECT_TRUE(OpenDocument("testing/resources/bug_487928.pdf"));
38  FPDF_PAGE page = LoadPage(0);
39  EXPECT_NE(nullptr, page);
40  DoOpenActions();
41  delegate.AdvanceTime(5000);
42  UnloadPage(page);
43}
44