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

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

Issue 2490403002: Mojo Bindings: Reset EDK error callback in ReportBadMessageTest::TearDown (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 ReportBadMessageTest() {} 62 ReportBadMessageTest() {}
63 63
64 void SetUp() override { 64 void SetUp() override {
65 mojo::edk::SetDefaultProcessErrorCallback( 65 mojo::edk::SetDefaultProcessErrorCallback(
66 base::Bind(&ReportBadMessageTest::OnProcessError, 66 base::Bind(&ReportBadMessageTest::OnProcessError,
67 base::Unretained(this))); 67 base::Unretained(this)));
68 68
69 impl_.BindImpl(GetProxy(&proxy_)); 69 impl_.BindImpl(GetProxy(&proxy_));
70 } 70 }
71 71
72 void TearDown() override {
73 mojo::edk::SetDefaultProcessErrorCallback(
74 mojo::edk::ProcessErrorCallback());
75 }
76
72 TestBadMessages* proxy() { return proxy_.get(); } 77 TestBadMessages* proxy() { return proxy_.get(); }
73 78
74 TestBadMessagesImpl* impl() { return &impl_; } 79 TestBadMessagesImpl* impl() { return &impl_; }
75 80
76 void SetErrorHandler(const base::Closure& handler) { 81 void SetErrorHandler(const base::Closure& handler) {
77 error_handler_ = handler; 82 error_handler_ = handler;
78 } 83 }
79 84
80 private: 85 private:
81 void OnProcessError(const std::string& error) { 86 void OnProcessError(const std::string& error) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 185 }
181 186
182 EXPECT_FALSE(error); 187 EXPECT_FALSE(error);
183 bad_message_callback.Run("nope nope nope"); 188 bad_message_callback.Run("nope nope nope");
184 EXPECT_TRUE(error); 189 EXPECT_TRUE(error);
185 } 190 }
186 191
187 } // namespace 192 } // namespace
188 } // namespace test 193 } // namespace test
189 } // namespace mojo 194 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698