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

Unified Diff: mojo/common/common_custom_types_unittest.cc

Issue 2333443002: Add base::UnguessableToken (Closed)
Patch Set: Addressing comments. 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..6c836dadc6efc10268f29af520efa6c1670e6138 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 TestNonceImpl : public TestNonce {
+ public:
+ explicit TestNonceImpl(TestNonceRequest request)
+ : binding_(this, std::move(request)) {}
+
+ // TestNonce implementation:
+ void BounceNonce(const base::Nonce& in,
+ const BounceNonceCallback& callback) override {
+ callback.Run(in);
+ }
+
+ private:
+ mojo::Binding<TestNonce> binding_;
+};
+
class TestTimeImpl : public TestTime {
public:
explicit TestTimeImpl(TestTimeRequest request)
@@ -176,6 +191,19 @@ TEST_F(CommonCustomTypesTest, FilePath) {
run_loop.Run();
}
+TEST_F(CommonCustomTypesTest, Nonce) {
+ base::RunLoop run_loop;
+
+ TestNoncePtr ptr;
+ TestNonceImpl impl(GetProxy(&ptr));
+
+ base::Nonce nonce = base::Nonce::Generate();
+
+ ptr->BounceNonce(nonce, ExpectResponse(&nonce, run_loop.QuitClosure()));
+
+ run_loop.Run();
+}
+
TEST_F(CommonCustomTypesTest, Time) {
base::RunLoop run_loop;

Powered by Google App Engine
This is Rietveld 408576698