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/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 EXPECT_TRUE(page); | 127 EXPECT_TRUE(page); |
128 DoOpenActions(); | 128 DoOpenActions(); |
129 delegate.AdvanceTime(5000); | 129 delegate.AdvanceTime(5000); |
130 UnloadPage(page); | 130 UnloadPage(page); |
131 | 131 |
132 const auto& alerts = delegate.GetAlerts(); | 132 const auto& alerts = delegate.GetAlerts(); |
133 ASSERT_EQ(1U, alerts.size()); | 133 ASSERT_EQ(1U, alerts.size()); |
134 EXPECT_STREQ(L"done", alerts[0].message.c_str()); | 134 EXPECT_STREQ(L"done", alerts[0].message.c_str()); |
135 } | 135 } |
136 | 136 |
| 137 TEST_F(FPDFFormFillEmbeddertest, BUG_634394) { |
| 138 // Cancel timer inside timer callback. |
| 139 EmbedderTestTimerHandlingDelegate delegate; |
| 140 SetDelegate(&delegate); |
| 141 |
| 142 EXPECT_TRUE(OpenDocument("bug_634394.pdf")); |
| 143 FPDF_PAGE page = LoadPage(0); |
| 144 EXPECT_TRUE(page); |
| 145 DoOpenActions(); |
| 146 |
| 147 // Timers fire at most once per AdvanceTime(), allow intervals |
| 148 // to fire several times if possible. |
| 149 delegate.AdvanceTime(1000); |
| 150 delegate.AdvanceTime(1000); |
| 151 delegate.AdvanceTime(1000); |
| 152 delegate.AdvanceTime(1000); |
| 153 delegate.AdvanceTime(1000); |
| 154 UnloadPage(page); |
| 155 |
| 156 const auto& alerts = delegate.GetAlerts(); |
| 157 EXPECT_EQ(2U, alerts.size()); |
| 158 } |
| 159 |
137 #endif // PDF_ENABLE_V8 | 160 #endif // PDF_ENABLE_V8 |
OLD | NEW |