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

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

Issue 2630963002: Migrate tests to use EXPECT_DCHECK_DEATH instead of EXPECT_DEATH. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « mojo/public/cpp/bindings/tests/BUILD.gn ('k') | 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 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/callback.h" 8 #include "base/callback.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "base/test/gtest_util.h"
12 #include "build/build_config.h" 13 #include "build/build_config.h"
13 #include "mojo/public/cpp/bindings/binding.h" 14 #include "mojo/public/cpp/bindings/binding.h"
14 #include "mojo/public/cpp/bindings/interface_ptr.h" 15 #include "mojo/public/cpp/bindings/interface_ptr.h"
15 #include "mojo/public/cpp/system/message_pipe.h" 16 #include "mojo/public/cpp/system/message_pipe.h"
16 #include "mojo/public/cpp/test_support/test_support.h" 17 #include "mojo/public/cpp/test_support/test_support.h"
17 #include "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h" 18 #include "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 20
20 /////////////////////////////////////////////////////////////////////////////// 21 ///////////////////////////////////////////////////////////////////////////////
21 // 22 //
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 server_impl.set_closure(run_loop.QuitClosure()); 323 server_impl.set_closure(run_loop.QuitClosure());
323 interface_ptr_->EchoInt( 324 interface_ptr_->EchoInt(
324 7, 325 7,
325 BindValueSaver(&last_client_callback_value_seen_, base::Closure())); 326 BindValueSaver(&last_client_callback_value_seen_, base::Closure()));
326 run_loop.Run(); 327 run_loop.Run();
327 328
328 // Check that server saw the correct value, but the client has not yet. 329 // Check that server saw the correct value, but the client has not yet.
329 EXPECT_EQ(7, server_impl.last_server_value_seen()); 330 EXPECT_EQ(7, server_impl.last_server_value_seen());
330 EXPECT_EQ(0, last_client_callback_value_seen_); 331 EXPECT_EQ(0, last_client_callback_value_seen_);
331 332
332 #if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) && !defined(OS_ANDROID) 333 EXPECT_DCHECK_DEATH(server_impl.DeleteCallback());
333 // Delete the callback without running it. This should cause a crash in debug
334 // builds due to a DCHECK.
335 std::string regex("Check failed: !is_valid");
336 #if defined(OS_WIN)
337 // TODO(msw): Fix MOJO_DCHECK logs and EXPECT_DEATH* on Win: crbug.com/535014
338 regex.clear();
339 #endif // OS_WIN
340 EXPECT_DEATH_IF_SUPPORTED(server_impl.DeleteCallback(), regex.c_str());
341 #endif // (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) &&
342 // !defined(OS_ANDROID)
343 } 334 }
344 335
345 } // namespace 336 } // namespace
346 } // namespace test 337 } // namespace test
347 } // namespace mojo 338 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/tests/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698