Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 PDFium Authors. All rights reserved. | 1 // Copyright 2015 PDFium 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 "../../public/fpdf_formfill.h" | 5 #include "../../public/fpdf_formfill.h" |
| 6 #include "../../testing/embedder_test.h" | 6 #include "../../testing/embedder_test.h" |
| 7 #include "../../testing/embedder_test_mock_delegate.h" | 7 #include "../../testing/embedder_test_mock_delegate.h" |
| 8 #include "../../testing/embedder_test_timer_handling_delegate.h" | 8 #include "../../testing/embedder_test_timer_handling_delegate.h" |
| 9 #include "../../testing/test_support.h" | |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 12 |
| 12 using testing::_; | 13 using testing::_; |
| 13 using testing::Return; | 14 using testing::Return; |
| 14 | 15 |
| 15 class FPDFFormFillEmbeddertest : public EmbedderTest {}; | 16 class FPDFFormFillEmbeddertest : public EmbedderTest {}; |
| 16 | 17 |
| 17 TEST_F(FPDFFormFillEmbeddertest, FirstTest) { | 18 TEST_F(FPDFFormFillEmbeddertest, FirstTest) { |
| 18 EmbedderTestMockDelegate mock; | 19 EmbedderTestMockDelegate mock; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 EXPECT_TRUE(OpenDocument("testing/resources/hello_world.pdf")); | 57 EXPECT_TRUE(OpenDocument("testing/resources/hello_world.pdf")); |
| 57 FPDF_PAGE page = LoadPage(0); | 58 FPDF_PAGE page = LoadPage(0); |
| 58 EXPECT_NE(nullptr, page); | 59 EXPECT_NE(nullptr, page); |
| 59 | 60 |
| 60 // Test that FORM_OnMouseMove() etc. permit null HANDLES and PAGES. | 61 // Test that FORM_OnMouseMove() etc. permit null HANDLES and PAGES. |
| 61 FORM_OnMouseMove(nullptr, page, 0, 10.0, 10.0); | 62 FORM_OnMouseMove(nullptr, page, 0, 10.0, 10.0); |
| 62 FORM_OnMouseMove(form_handle(), nullptr, 0, 10.0, 10.0); | 63 FORM_OnMouseMove(form_handle(), nullptr, 0, 10.0, 10.0); |
| 63 | 64 |
| 64 UnloadPage(page); | 65 UnloadPage(page); |
| 65 } | 66 } |
| 67 | |
| 68 TEST_F(FPDFFormFillEmbeddertest, BUG_551248) { | |
| 69 EmbedderTestTimerHandlingDelegate delegate; | |
| 70 SetDelegate(&delegate); | |
| 71 | |
| 72 EXPECT_TRUE(OpenDocument("testing/resources/bug_551248.pdf")); | |
| 73 FPDF_PAGE page = LoadPage(0); | |
| 74 EXPECT_NE(nullptr, page); | |
| 75 DoOpenActions(); | |
| 76 delegate.AdvanceTime(5000); | |
| 77 UnloadPage(page); | |
| 78 | |
| 79 const auto& alerts = delegate.GetAlerts(); | |
| 80 ASSERT_EQ(1U, alerts.size()); | |
| 81 | |
| 82 wchar_t* message = GetWideString(alerts[0].message); | |
|
dsinclair
2015/11/04 14:15:07
FX_WCHAR?
Lei Zhang
2015/11/04 22:11:29
Nope, see same comment in other file.
| |
| 83 wchar_t* title = GetWideString(alerts[0].title); | |
|
dsinclair
2015/11/04 14:15:07
Can these go in a unique_ptr so they just get clea
Lei Zhang
2015/11/04 22:11:29
Went with std::wstring.
| |
| 84 EXPECT_STREQ(L"hello chamal", message); | |
|
Tom Sepez
2015/11/04 18:02:33
nit: we might want to sanitize chamal's identity.
Lei Zhang
2015/11/04 22:11:29
But hello world is so boring. The bug is public, *
| |
| 85 EXPECT_STREQ(L"Alert", title); | |
| 86 EXPECT_EQ(0, alerts[0].type); | |
| 87 EXPECT_EQ(0, alerts[0].icon); | |
| 88 free(message); | |
| 89 free(title); | |
| 90 } | |
| OLD | NEW |