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

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

Issue 1819463002: Make mojo::Callback safe to copy across threads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 ValueSaver(&last_client_callback_value_seen_, base::Closure())); 331 ValueSaver(&last_client_callback_value_seen_, base::Closure()));
332 run_loop.Run(); 332 run_loop.Run();
333 333
334 // Check that server saw the correct value, but the client has not yet. 334 // Check that server saw the correct value, but the client has not yet.
335 EXPECT_EQ(7, server_impl.last_server_value_seen()); 335 EXPECT_EQ(7, server_impl.last_server_value_seen());
336 EXPECT_EQ(0, last_client_callback_value_seen_); 336 EXPECT_EQ(0, last_client_callback_value_seen_);
337 337
338 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) 338 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
339 // Delete the callback without running it. This should cause a crash in debug 339 // Delete the callback without running it. This should cause a crash in debug
340 // builds due to a DCHECK. 340 // builds due to a DCHECK.
341 std::string regex("Check failed: !callback_was_dropped."); 341 std::string regex("Check failed: !is_valid");
342 #if defined(OS_WIN) 342 #if defined(OS_WIN)
343 // TODO(msw): Fix MOJO_DCHECK logs and EXPECT_DEATH* on Win: crbug.com/535014 343 // TODO(msw): Fix MOJO_DCHECK logs and EXPECT_DEATH* on Win: crbug.com/535014
344 regex.clear(); 344 regex.clear();
345 #endif // OS_WIN 345 #endif // OS_WIN
346 EXPECT_DEATH_IF_SUPPORTED(server_impl.DeleteCallback(), regex.c_str()); 346 EXPECT_DEATH_IF_SUPPORTED(server_impl.DeleteCallback(), regex.c_str());
347 #endif // !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) 347 #endif // !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
348 } 348 }
349 349
350 } // namespace 350 } // namespace
351 } // namespace test 351 } // namespace test
352 } // namespace mojo 352 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/message.h ('k') | mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698