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 #ifndef TESTING_EMBEDDER_TEST_TIMER_HANDLING_DELEGATE_H_ | 5 #ifndef TESTING_EMBEDDER_TEST_TIMER_HANDLING_DELEGATE_H_ |
6 #define TESTING_EMBEDDER_TEST_TIMER_HANDLING_DELEGATE_H_ | 6 #define TESTING_EMBEDDER_TEST_TIMER_HANDLING_DELEGATE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
| 9 #include <string> |
9 #include <utility> | 10 #include <utility> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "embedder_test.h" | 13 #include "embedder_test.h" |
| 14 #include "test_support.h" |
13 | 15 |
14 class EmbedderTestTimerHandlingDelegate : public EmbedderTest::Delegate { | 16 class EmbedderTestTimerHandlingDelegate : public EmbedderTest::Delegate { |
15 public: | 17 public: |
16 struct ReceivedAlert { | 18 struct ReceivedAlert { |
17 ReceivedAlert(FPDF_WIDESTRING message_in, | 19 ReceivedAlert(FPDF_WIDESTRING message_in, |
18 FPDF_WIDESTRING title_in, | 20 FPDF_WIDESTRING title_in, |
19 int type_in, | 21 int type_in, |
20 int icon_in) | 22 int icon_in) |
21 : message(message_in), title(title_in), type(type_in), icon(icon_in) {} | 23 : type(type_in), icon(icon_in) { |
| 24 message = GetWideString(message_in); |
| 25 title = GetWideString(title_in); |
| 26 } |
22 | 27 |
23 FPDF_WIDESTRING message; | 28 std::wstring message; |
24 FPDF_WIDESTRING title; | 29 std::wstring title; |
25 int type; | 30 int type; |
26 int icon; | 31 int icon; |
27 }; | 32 }; |
28 | 33 |
29 int Alert(FPDF_WIDESTRING message, | 34 int Alert(FPDF_WIDESTRING message, |
30 FPDF_WIDESTRING title, | 35 FPDF_WIDESTRING title, |
31 int type, | 36 int type, |
32 int icon) override { | 37 int icon) override { |
33 alerts_.push_back(ReceivedAlert(message, title, type, icon)); | 38 alerts_.push_back(ReceivedAlert(message, title, type, icon)); |
34 return 0; | 39 return 0; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 75 |
71 protected: | 76 protected: |
72 using Timer = std::pair<int, TimerCallback>; // ID, callback pair. | 77 using Timer = std::pair<int, TimerCallback>; // ID, callback pair. |
73 std::multimap<int, Timer> expiry_to_timer_map_; // Keyed by timeout. | 78 std::multimap<int, Timer> expiry_to_timer_map_; // Keyed by timeout. |
74 int next_timer_id_ = 0; | 79 int next_timer_id_ = 0; |
75 int imaginary_elapsed_msecs_ = 0; | 80 int imaginary_elapsed_msecs_ = 0; |
76 std::vector<ReceivedAlert> alerts_; | 81 std::vector<ReceivedAlert> alerts_; |
77 }; | 82 }; |
78 | 83 |
79 #endif // TESTING_EMBEDDER_TEST_TIMER_HANDLING_DELEGATE_H_ | 84 #endif // TESTING_EMBEDDER_TEST_TIMER_HANDLING_DELEGATE_H_ |
OLD | NEW |