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

Unified Diff: mojo/common/common_custom_types_unittest.cc

Issue 2333443002: Add base::UnguessableToken (Closed)
Patch Set: NonceTokenHash CHECK --> DCHECK 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..b78418d81452179095bcb8d8cf44b0526bf95e93 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 TestNonceTokenImpl : public TestNonceToken {
+ public:
+ explicit TestNonceTokenImpl(TestNonceTokenRequest request)
+ : binding_(this, std::move(request)) {}
+
+ // TestNonceToken implementation:
+ void BounceNonce(const base::NonceToken& in,
+ const BounceNonceCallback& callback) override {
+ callback.Run(in);
+ }
+
+ private:
+ mojo::Binding<TestNonceToken> binding_;
+};
+
class TestTimeImpl : public TestTime {
public:
explicit TestTimeImpl(TestTimeRequest request)
@@ -176,6 +191,19 @@ TEST_F(CommonCustomTypesTest, FilePath) {
run_loop.Run();
}
+TEST_F(CommonCustomTypesTest, NonceToken) {
+ base::RunLoop run_loop;
+
+ TestNonceTokenPtr ptr;
+ TestNonceTokenImpl impl(GetProxy(&ptr));
+
+ base::NonceToken token = base::NonceToken::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