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

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

Issue 1314673008: Migrate logging infrastructure Isolate->Thread (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix test. Created 5 years, 3 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 (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 29 matching lines...) Expand all
40 static void SetPrinter(Log* log, LogPrinter printer) { 40 static void SetPrinter(Log* log, LogPrinter printer) {
41 ASSERT(log != NULL); 41 ASSERT(log != NULL);
42 ASSERT(printer != NULL); 42 ASSERT(printer != NULL);
43 log->printer_ = printer; 43 log->printer_ = printer;
44 } 44 }
45 }; 45 };
46 46
47 47
48 TEST_CASE(Log_Macro) { 48 TEST_CASE(Log_Macro) {
49 test_output_ = NULL; 49 test_output_ = NULL;
50 Isolate* isolate = Isolate::Current(); 50 Log* log = Log::Current();
51 Log* log = isolate->Log();
52 LogTestHelper::SetPrinter(log, TestPrinter); 51 LogTestHelper::SetPrinter(log, TestPrinter);
53 52
54 ISL_Print("Hello %s", "World"); 53 THR_Print("Hello %s", "World");
55 EXPECT_STREQ("Hello World", test_output_); 54 EXPECT_STREQ("Hello World", test_output_);
56 ISL_Print("SingleArgument"); 55 THR_Print("SingleArgument");
57 EXPECT_STREQ("SingleArgument", test_output_); 56 EXPECT_STREQ("SingleArgument", test_output_);
58 } 57 }
59 58
60 59
61 TEST_CASE(Log_Basic) { 60 TEST_CASE(Log_Basic) {
62 test_output_ = NULL; 61 test_output_ = NULL;
63 Log* log = new Log(TestPrinter); 62 Log* log = new Log(TestPrinter);
64 63
65 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_); 64 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_);
66 log->Print("Hello %s", "World"); 65 log->Print("Hello %s", "World");
67 EXPECT_STREQ("Hello World", test_output_); 66 EXPECT_STREQ("Hello World", test_output_);
68 } 67 }
69 68
70 69
71 TEST_CASE(Log_Block) { 70 TEST_CASE(Log_Block) {
72 test_output_ = NULL; 71 test_output_ = NULL;
73 Log* log = new Log(TestPrinter); 72 Log* log = new Log(TestPrinter);
74 73
75 Isolate* isolate = Isolate::Current();
76
77 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_); 74 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_);
78 { 75 {
79 LogBlock ba(isolate, log); 76 LogBlock ba(thread, log);
80 log->Print("APPLE"); 77 log->Print("APPLE");
81 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_); 78 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_);
82 { 79 {
83 LogBlock ba(isolate, log); 80 LogBlock ba(thread, log);
84 log->Print("BANANA"); 81 log->Print("BANANA");
85 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_); 82 EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_);
86 } 83 }
87 EXPECT_STREQ("BANANA", test_output_); 84 EXPECT_STREQ("BANANA", test_output_);
88 } 85 }
89 EXPECT_STREQ("APPLE", test_output_); 86 EXPECT_STREQ("APPLE", test_output_);
90 } 87 }
91 88
92 } // namespace dart 89 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/log.cc ('k') | runtime/vm/object.cc » ('j') | runtime/vm/thread.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698