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

Side by Side Diff: runtime/vm/log_test.cc

Issue 2999833002: [VM logging] Fix nesting of log blocker (second attempt). (Closed)
Patch Set: Created 3 years, 4 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 | « runtime/vm/log.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 #include "platform/globals.h" 5 #include "platform/globals.h"
6 6
7 #include "include/dart_tools_api.h" 7 #include "include/dart_tools_api.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/debugger.h" 10 #include "vm/debugger.h"
(...skipping 18 matching lines...) Expand all
29 va_list args2; 29 va_list args2;
30 va_start(args2, format); 30 va_start(args2, format);
31 OS::VSNPrint(buffer, (len + 1), format, args2); 31 OS::VSNPrint(buffer, (len + 1), format, args2);
32 va_end(args2); 32 va_end(args2);
33 33
34 if (test_output_ != NULL) { 34 if (test_output_ != NULL) {
35 free(const_cast<char*>(test_output_)); 35 free(const_cast<char*>(test_output_));
36 test_output_ = NULL; 36 test_output_ = NULL;
37 } 37 }
38 test_output_ = buffer; 38 test_output_ = buffer;
39
40 // Also print to stdout to see the overall result.
41 OS::Print("%s", test_output_);
39 } 42 }
40 43
41 class LogTestHelper : public AllStatic { 44 class LogTestHelper : public AllStatic {
42 public: 45 public:
43 static void SetPrinter(Log* log, LogPrinter printer) { 46 static void SetPrinter(Log* log, LogPrinter printer) {
44 ASSERT(log != NULL); 47 ASSERT(log != NULL);
45 ASSERT(printer != NULL); 48 ASSERT(printer != NULL);
46 log->printer_ = printer; 49 log->printer_ = printer;
47 } 50 }
48 51
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_); 88 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_);
86 { 89 {
87 LogBlock ba(thread, log); 90 LogBlock ba(thread, log);
88 log->Print("APPLE"); 91 log->Print("APPLE");
89 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_); 92 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_);
90 { 93 {
91 LogBlock ba(thread, log); 94 LogBlock ba(thread, log);
92 log->Print("BANANA"); 95 log->Print("BANANA");
93 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_); 96 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_);
94 } 97 }
95 EXPECT_STREQ("BANANA", test_output_); 98 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_);
99 {
100 LogBlock ba(thread, log);
101 log->Print("PEAR");
102 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_);
103 }
104 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_);
96 } 105 }
97 EXPECT_STREQ("APPLE", test_output_); 106 EXPECT_STREQ("APPLEBANANAPEAR", test_output_);
98 delete log; 107 delete log;
99 LogTestHelper::FreeTestOutput(); 108 LogTestHelper::FreeTestOutput();
100 } 109 }
101 110
102 } // namespace dart 111 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/log.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698