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

Unified Diff: test/cctest/test-log.cc

Issue 661246: Logging-related changes. (Closed)
Patch Set: Created 10 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/log.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-log.cc
diff --git a/test/cctest/test-log.cc b/test/cctest/test-log.cc
index 9853af32444fa4c40365b4c7110ced67dc3bcd46..6b3639c49605e25a07f65f9ffcebc5eeb0d8a438 100644
--- a/test/cctest/test-log.cc
+++ b/test/cctest/test-log.cc
@@ -174,12 +174,11 @@ namespace {
class ScopedLoggerInitializer {
public:
- explicit ScopedLoggerInitializer(bool log, bool prof_lazy)
- : saved_log_(i::FLAG_log),
- saved_prof_lazy_(i::FLAG_prof_lazy),
+ explicit ScopedLoggerInitializer(bool prof_lazy)
+ : saved_prof_lazy_(i::FLAG_prof_lazy),
saved_prof_(i::FLAG_prof),
saved_prof_auto_(i::FLAG_prof_auto),
- trick_to_run_init_flags_(init_flags_(log, prof_lazy)),
+ trick_to_run_init_flags_(init_flags_(prof_lazy)),
need_to_set_up_logger_(i::V8::IsRunning()),
scope_(),
env_(v8::Context::New()) {
@@ -193,14 +192,12 @@ class ScopedLoggerInitializer {
i::FLAG_prof_lazy = saved_prof_lazy_;
i::FLAG_prof = saved_prof_;
i::FLAG_prof_auto = saved_prof_auto_;
- i::FLAG_log = saved_log_;
}
v8::Handle<v8::Context>& env() { return env_; }
private:
- static bool init_flags_(bool log, bool prof_lazy) {
- i::FLAG_log = log;
+ static bool init_flags_(bool prof_lazy) {
i::FLAG_prof = true;
i::FLAG_prof_lazy = prof_lazy;
i::FLAG_prof_auto = false;
@@ -208,7 +205,6 @@ class ScopedLoggerInitializer {
return prof_lazy;
}
- const bool saved_log_;
const bool saved_prof_lazy_;
const bool saved_prof_;
const bool saved_prof_auto_;
@@ -320,7 +316,7 @@ static void CheckThatProfilerWorks(LogBufferMatcher* matcher) {
TEST(ProfLazyMode) {
- ScopedLoggerInitializer initialize_logger(false, true);
+ ScopedLoggerInitializer initialize_logger(true);
// No sampling should happen prior to resuming profiler.
CHECK(!LoggerTestHelper::IsSamplerActive());
@@ -540,7 +536,7 @@ static v8::Handle<v8::Value> ObjMethod1(const v8::Arguments& args) {
}
TEST(LogCallbacks) {
- ScopedLoggerInitializer initialize_logger(false, false);
+ ScopedLoggerInitializer initialize_logger(false);
LogBufferMatcher matcher;
v8::Persistent<v8::FunctionTemplate> obj =
@@ -590,7 +586,7 @@ static v8::Handle<v8::Value> Prop2Getter(v8::Local<v8::String> property,
}
TEST(LogAccessorCallbacks) {
- ScopedLoggerInitializer initialize_logger(false, false);
+ ScopedLoggerInitializer initialize_logger(false);
LogBufferMatcher matcher;
v8::Persistent<v8::FunctionTemplate> obj =
@@ -625,7 +621,7 @@ TEST(LogAccessorCallbacks) {
TEST(LogTags) {
- ScopedLoggerInitializer initialize_logger(true, false);
+ ScopedLoggerInitializer initialize_logger(false);
LogBufferMatcher matcher;
const char* open_tag = "open-tag,";
@@ -710,6 +706,35 @@ TEST(LogTags) {
}
+TEST(IsLoggingPreserved) {
+ ScopedLoggerInitializer initialize_logger(false);
+
+ CHECK(Logger::is_logging());
+ Logger::ResumeProfiler(v8::PROFILER_MODULE_CPU, 1);
+ CHECK(Logger::is_logging());
+ Logger::PauseProfiler(v8::PROFILER_MODULE_CPU, 1);
+ CHECK(Logger::is_logging());
+
+ CHECK(Logger::is_logging());
+ Logger::ResumeProfiler(
+ v8::PROFILER_MODULE_HEAP_STATS | v8::PROFILER_MODULE_JS_CONSTRUCTORS, 1);
+ CHECK(Logger::is_logging());
+ Logger::PauseProfiler(
+ v8::PROFILER_MODULE_HEAP_STATS | v8::PROFILER_MODULE_JS_CONSTRUCTORS, 1);
+ CHECK(Logger::is_logging());
+
+ CHECK(Logger::is_logging());
+ Logger::ResumeProfiler(
+ v8::PROFILER_MODULE_CPU |
+ v8::PROFILER_MODULE_HEAP_STATS | v8::PROFILER_MODULE_JS_CONSTRUCTORS, 1);
+ CHECK(Logger::is_logging());
+ Logger::PauseProfiler(
+ v8::PROFILER_MODULE_CPU |
+ v8::PROFILER_MODULE_HEAP_STATS | v8::PROFILER_MODULE_JS_CONSTRUCTORS, 1);
+ CHECK(Logger::is_logging());
+}
+
+
static inline bool IsStringEqualTo(const char* r, const char* s) {
return strncmp(r, s, strlen(r)) == 0;
}
« no previous file with comments | « src/log.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698