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

Unified Diff: mojo/common/common_custom_types_unittest.cc

Issue 2333443002: Add base::UnguessableToken (Closed)
Patch Set: Serialize --> Serialization getters Created 4 years, 3 months 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
Index: mojo/common/common_custom_types_unittest.cc
diff --git a/mojo/common/common_custom_types_unittest.cc b/mojo/common/common_custom_types_unittest.cc
index 7e8252dbc613a33b6c0acc69c0730a3041837d69..d6ec8f7f855c5b5756ee1fafb07b745f01563461 100644
--- a/mojo/common/common_custom_types_unittest.cc
+++ b/mojo/common/common_custom_types_unittest.cc
@@ -90,6 +90,21 @@ class TestFilePathImpl : public TestFilePath {
mojo::Binding<TestFilePath> binding_;
};
+class TestUnguessableTokenImpl : public TestUnguessableToken {
+ public:
+ explicit TestUnguessableTokenImpl(TestUnguessableTokenRequest request)
+ : binding_(this, std::move(request)) {}
+
+ // TestUnguessableToken implementation:
+ void BounceNonce(const base::UnguessableToken& in,
+ const BounceNonceCallback& callback) override {
+ callback.Run(in);
+ }
+
+ private:
+ mojo::Binding<TestUnguessableToken> binding_;
+};
+
class TestTimeImpl : public TestTime {
public:
explicit TestTimeImpl(TestTimeRequest request)
@@ -176,6 +191,19 @@ TEST_F(CommonCustomTypesTest, FilePath) {
run_loop.Run();
}
+TEST_F(CommonCustomTypesTest, UnguessableToken) {
+ base::RunLoop run_loop;
+
+ TestUnguessableTokenPtr ptr;
+ TestUnguessableTokenImpl impl(GetProxy(&ptr));
+
+ base::UnguessableToken token = base::UnguessableToken::Create();
+
+ ptr->BounceNonce(token, ExpectResponse(&token, run_loop.QuitClosure()));
+
+ run_loop.Run();
+}
+
TEST_F(CommonCustomTypesTest, Time) {
base::RunLoop run_loop;

Powered by Google App Engine
This is Rietveld 408576698