Index: mojo/public/cpp/bindings/tests/rect_blink.h |
diff --git a/mojo/public/cpp/bindings/tests/rect_blink.h b/mojo/public/cpp/bindings/tests/rect_blink.h |
index de7a7922a589d3ee2eb21aed0b557e75170b7f74..73359895934bdc88d5c8ddd8a2322bb08d8e8fe7 100644 |
--- a/mojo/public/cpp/bindings/tests/rect_blink.h |
+++ b/mojo/public/cpp/bindings/tests/rect_blink.h |
@@ -51,6 +51,12 @@ class RectBlink { |
int computeArea() const { return width_ * height_; } |
+ bool operator==(const RectBlink& other) const { |
+ return (x() == other.x() && y() == other.y() && width() == other.width() && |
+ height() == other.height()); |
+ } |
+ bool operator!=(const RectBlink& other) const { return !(*this == other); } |
+ |
private: |
int x_ = 0; |
int y_ = 0; |
@@ -61,4 +67,17 @@ class RectBlink { |
} // namespace test |
} // namespace mojo |
+namespace std { |
+ |
+template <> |
+struct hash<mojo::test::RectBlink> { |
+ size_t operator()(const mojo::test::RectBlink& value) { |
+ // Terrible hash function: |
+ return (std::hash<int>()(value.x()) ^ std::hash<int>()(value.y()) ^ |
+ std::hash<int>()(value.width()) ^ std::hash<int>()(value.height())); |
+ } |
+}; |
+ |
+} // namespace std |
+ |
#endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_RECT_BLINK_H_ |