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

Side by Side Diff: mojo/public/cpp/bindings/tests/report_bad_message_unittest.cc

Issue 2664483002: Support sync mojo IPCs to and from bindings running on a sequence.
Patch Set: Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "mojo/edk/embedder/embedder.h" 10 #include "mojo/edk/embedder/embedder.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 void SetErrorHandler(const base::Closure& handler) { 81 void SetErrorHandler(const base::Closure& handler) {
82 error_handler_ = handler; 82 error_handler_ = handler;
83 } 83 }
84 84
85 private: 85 private:
86 void OnProcessError(const std::string& error) { 86 void OnProcessError(const std::string& error) {
87 if (!error_handler_.is_null()) 87 if (!error_handler_.is_null())
88 error_handler_.Run(); 88 error_handler_.Run();
89 } 89 }
90 90
91 base::MessageLoop message_loop;
91 TestBadMessagesPtr proxy_; 92 TestBadMessagesPtr proxy_;
92 TestBadMessagesImpl impl_; 93 TestBadMessagesImpl impl_;
93 base::Closure error_handler_; 94 base::Closure error_handler_;
94 base::MessageLoop message_loop;
95 }; 95 };
96 96
97 TEST_F(ReportBadMessageTest, Request) { 97 TEST_F(ReportBadMessageTest, Request) {
98 // Verify that basic immediate error reporting works. 98 // Verify that basic immediate error reporting works.
99 bool error = false; 99 bool error = false;
100 SetErrorHandler(base::Bind([] (bool* flag) { *flag = true; }, &error)); 100 SetErrorHandler(base::Bind([] (bool* flag) { *flag = true; }, &error));
101 EXPECT_TRUE(proxy()->RejectSync()); 101 EXPECT_TRUE(proxy()->RejectSync());
102 EXPECT_TRUE(error); 102 EXPECT_TRUE(error);
103 } 103 }
104 104
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 } 185 }
186 186
187 EXPECT_FALSE(error); 187 EXPECT_FALSE(error);
188 bad_message_callback.Run("nope nope nope"); 188 bad_message_callback.Run("nope nope nope");
189 EXPECT_TRUE(error); 189 EXPECT_TRUE(error);
190 } 190 }
191 191
192 } // namespace 192 } // namespace
193 } // namespace test 193 } // namespace test
194 } // namespace mojo 194 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/tests/multiplex_router_unittest.cc ('k') | mojo/public/cpp/bindings/tests/sync_method_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698