Index: mojo/public/cpp/bindings/tests/rect_chromium.h |
diff --git a/mojo/public/cpp/bindings/tests/rect_chromium.h b/mojo/public/cpp/bindings/tests/rect_chromium.h |
index 20c43628c3ab60d0039491c257e515b7a3a43356..d2e0a3e635b8004021f75f0066c45f2a23b48bb4 100644 |
--- a/mojo/public/cpp/bindings/tests/rect_chromium.h |
+++ b/mojo/public/cpp/bindings/tests/rect_chromium.h |
@@ -55,6 +55,12 @@ class RectChromium { |
int GetArea() const { return width_ * height_; } |
+ bool operator==(const RectChromium& other) const { |
+ return (x() == other.x() && y() == other.y() && width() == other.width() && |
+ height() == other.height()); |
+ } |
+ bool operator!=(const RectChromium& other) const { return !(*this == other); } |
+ |
private: |
int x_ = 0; |
int y_ = 0; |
@@ -65,4 +71,17 @@ class RectChromium { |
} // namespace test |
} // namespace mojo |
+namespace std { |
+ |
+template <> |
+struct hash<mojo::test::RectChromium> { |
+ size_t operator()(const mojo::test::RectChromium& 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_CHROMIUM_H_ |