Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Unified Diff: testing/embedder_test_timer_handling_delegate.h

Issue 1424743006: Make JS app.setTimeOut() work again. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samples/pdfium_test.cc ('k') | testing/resources/bug_551248.in » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/embedder_test_timer_handling_delegate.h
diff --git a/testing/embedder_test_timer_handling_delegate.h b/testing/embedder_test_timer_handling_delegate.h
index aca4ac1b771a0796411f51dc1321f74219a754a3..0137aae45f978eb8b6e87e39978ce26c14cc2e60 100644
--- a/testing/embedder_test_timer_handling_delegate.h
+++ b/testing/embedder_test_timer_handling_delegate.h
@@ -7,11 +7,33 @@
#include <map>
#include <utility>
+#include <vector>
#include "embedder_test.h"
class EmbedderTestTimerHandlingDelegate : public EmbedderTest::Delegate {
public:
+ struct ReceivedAlert {
+ ReceivedAlert(FPDF_WIDESTRING message_in,
+ FPDF_WIDESTRING title_in,
+ int type_in,
+ int icon_in)
+ : message(message_in), title(title_in), type(type_in), icon(icon_in) {}
+
+ FPDF_WIDESTRING message;
Tom Sepez 2015/11/04 23:01:11 maybe make these the std::wstrings() so the copy h
+ FPDF_WIDESTRING title;
+ int type;
+ int icon;
+ };
+
+ int Alert(FPDF_WIDESTRING message,
+ FPDF_WIDESTRING title,
+ int type,
+ int icon) override {
+ alerts_.push_back(ReceivedAlert(message, title, type, icon));
+ return 0;
+ }
+
int SetTimer(int msecs, TimerCallback fn) override {
expiry_to_timer_map_.insert(std::pair<int, Timer>(
msecs + imaginary_elapsed_msecs_, Timer(++next_timer_id_, fn)));
@@ -44,11 +66,14 @@ class EmbedderTestTimerHandlingDelegate : public EmbedderTest::Delegate {
}
}
+ const std::vector<ReceivedAlert>& GetAlerts() const { return alerts_; }
+
protected:
using Timer = std::pair<int, TimerCallback>; // ID, callback pair.
std::multimap<int, Timer> expiry_to_timer_map_; // Keyed by timeout.
int next_timer_id_ = 0;
int imaginary_elapsed_msecs_ = 0;
+ std::vector<ReceivedAlert> alerts_;
};
#endif // TESTING_EMBEDDER_TEST_TIMER_HANDLING_DELEGATE_H_
« no previous file with comments | « samples/pdfium_test.cc ('k') | testing/resources/bug_551248.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698