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

Side by Side Diff: runtime/vm/unit_test.h

Issue 2640573003: Resolution for issue #5092: Unit test handle checks consider dangling handles to be valid. (Closed)
Patch Set: Removed Dart API entry for IsValid. 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
« runtime/vm/dart_api_impl.cc ('K') | « runtime/vm/thread_registry.cc ('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 (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef RUNTIME_VM_UNIT_TEST_H_ 5 #ifndef RUNTIME_VM_UNIT_TEST_H_
6 #define RUNTIME_VM_UNIT_TEST_H_ 6 #define RUNTIME_VM_UNIT_TEST_H_
7 7
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 9
10 #include "platform/globals.h" 10 #include "platform/globals.h"
11 11
12 #include "vm/ast.h" 12 #include "vm/ast.h"
13 #include "vm/dart.h" 13 #include "vm/dart.h"
14 #include "vm/dart_api_state.h"
14 #include "vm/globals.h" 15 #include "vm/globals.h"
15 #include "vm/heap.h" 16 #include "vm/heap.h"
16 #include "vm/isolate.h" 17 #include "vm/isolate.h"
17 #include "vm/longjump.h" 18 #include "vm/longjump.h"
18 #include "vm/object.h" 19 #include "vm/object.h"
19 #include "vm/object_store.h" 20 #include "vm/object_store.h"
20 #include "vm/simulator.h" 21 #include "vm/simulator.h"
21 #include "vm/zone.h" 22 #include "vm/zone.h"
22 23
23 // The UNIT_TEST_CASE macro is used for tests that do not need any 24 // The UNIT_TEST_CASE macro is used for tests that do not need any
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 static bool TestCompileScript(const Library& library, const Script& script); 533 static bool TestCompileScript(const Library& library, const Script& script);
533 534
534 // Test the Compiler::CompileFunction functionality by checking the return 535 // Test the Compiler::CompileFunction functionality by checking the return
535 // value to see if no parse errors were reported. 536 // value to see if no parse errors were reported.
536 static bool TestCompileFunction(const Function& function); 537 static bool TestCompileFunction(const Function& function);
537 }; 538 };
538 539
539 #define EXPECT_VALID(handle) \ 540 #define EXPECT_VALID(handle) \
540 do { \ 541 do { \
541 Dart_Handle tmp_handle = (handle); \ 542 Dart_Handle tmp_handle = (handle); \
543 if (!Api::IsValid(tmp_handle)) { \
544 dart::Expect(__FILE__, __LINE__) \
545 .Fail( \
546 "expected '%s' to be a valid handle but '%s' has already been " \
547 "freed\n", \
548 #handle, #handle); \
549 } \
542 if (Dart_IsError(tmp_handle)) { \ 550 if (Dart_IsError(tmp_handle)) { \
543 dart::Expect(__FILE__, __LINE__) \ 551 dart::Expect(__FILE__, __LINE__) \
544 .Fail( \ 552 .Fail( \
545 "expected '%s' to be a valid handle but found an error " \ 553 "expected '%s' to be a valid handle but found an error " \
546 "handle:\n" \ 554 "handle:\n" \
547 " '%s'\n", \ 555 " '%s'\n", \
548 #handle, Dart_GetError(tmp_handle)); \ 556 #handle, Dart_GetError(tmp_handle)); \
549 } \ 557 } \
550 } while (0) 558 } while (0)
551 559
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 ~SetFlagScope() { *flag_ = original_value_; } 616 ~SetFlagScope() { *flag_ = original_value_; }
609 617
610 private: 618 private:
611 T* flag_; 619 T* flag_;
612 T original_value_; 620 T original_value_;
613 }; 621 };
614 622
615 } // namespace dart 623 } // namespace dart
616 624
617 #endif // RUNTIME_VM_UNIT_TEST_H_ 625 #endif // RUNTIME_VM_UNIT_TEST_H_
OLDNEW
« runtime/vm/dart_api_impl.cc ('K') | « runtime/vm/thread_registry.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698