| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdio.h> | 5 #include <stdio.h> |
| 6 #include <cmath> | 6 #include <cmath> |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include <GLES2/gl2.h> | 10 #include <GLES2/gl2.h> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 context_->GetGLInterface(), helper_.get())); | 69 context_->GetGLInterface(), helper_.get())); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void TearDown() override { | 72 void TearDown() override { |
| 73 helper_scaling_.reset(NULL); | 73 helper_scaling_.reset(NULL); |
| 74 helper_.reset(NULL); | 74 helper_.reset(NULL); |
| 75 context_.reset(NULL); | 75 context_.reset(NULL); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void StartTracing(const std::string& filter) { | 78 void StartTracing(const std::string& filter) { |
| 79 base::debug::TraceLog::GetInstance()->SetEnabled( | 79 base::trace_event::TraceLog::GetInstance()->SetEnabled( |
| 80 base::debug::CategoryFilter(filter), | 80 base::trace_event::CategoryFilter(filter), |
| 81 base::debug::TraceLog::RECORDING_MODE, | 81 base::trace_event::TraceLog::RECORDING_MODE, |
| 82 base::debug::TraceOptions( | 82 base::trace_event::TraceOptions( |
| 83 base::debug::RECORD_UNTIL_FULL)); | 83 base::trace_event::RECORD_UNTIL_FULL)); |
| 84 } | 84 } |
| 85 | 85 |
| 86 static void TraceDataCB( | 86 static void TraceDataCB( |
| 87 const base::Callback<void()>& callback, | 87 const base::Callback<void()>& callback, |
| 88 std::string* output, | 88 std::string* output, |
| 89 const scoped_refptr<base::RefCountedString>& json_events_str, | 89 const scoped_refptr<base::RefCountedString>& json_events_str, |
| 90 bool has_more_events) { | 90 bool has_more_events) { |
| 91 if (output->size() > 1) { | 91 if (output->size() > 1) { |
| 92 output->append(","); | 92 output->append(","); |
| 93 } | 93 } |
| 94 output->append(json_events_str->data()); | 94 output->append(json_events_str->data()); |
| 95 if (!has_more_events) { | 95 if (!has_more_events) { |
| 96 callback.Run(); | 96 callback.Run(); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 // End tracing, return tracing data in a simple map | 100 // End tracing, return tracing data in a simple map |
| 101 // of event name->counts. | 101 // of event name->counts. |
| 102 void EndTracing(std::map<std::string, int>* event_counts) { | 102 void EndTracing(std::map<std::string, int>* event_counts) { |
| 103 std::string json_data = "["; | 103 std::string json_data = "["; |
| 104 base::debug::TraceLog::GetInstance()->SetDisabled(); | 104 base::trace_event::TraceLog::GetInstance()->SetDisabled(); |
| 105 base::RunLoop run_loop; | 105 base::RunLoop run_loop; |
| 106 base::debug::TraceLog::GetInstance()->Flush( | 106 base::trace_event::TraceLog::GetInstance()->Flush( |
| 107 base::Bind(&GLHelperTest::TraceDataCB, | 107 base::Bind(&GLHelperTest::TraceDataCB, |
| 108 run_loop.QuitClosure(), | 108 run_loop.QuitClosure(), |
| 109 base::Unretained(&json_data))); | 109 base::Unretained(&json_data))); |
| 110 run_loop.Run(); | 110 run_loop.Run(); |
| 111 json_data.append("]"); | 111 json_data.append("]"); |
| 112 | 112 |
| 113 scoped_ptr<base::Value> trace_data(base::JSONReader::Read(json_data)); | 113 scoped_ptr<base::Value> trace_data(base::JSONReader::Read(json_data)); |
| 114 base::ListValue* list; | 114 base::ListValue* list; |
| 115 CHECK(trace_data->GetAsList(&list)); | 115 CHECK(trace_data->GetAsList(&list)); |
| 116 for (size_t i = 0; i < list->GetSize(); i++) { | 116 for (size_t i = 0; i < list->GetSize(); i++) { |
| (...skipping 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1971 base::TestSuite* suite = new content::ContentTestSuite(argc, argv); | 1971 base::TestSuite* suite = new content::ContentTestSuite(argc, argv); |
| 1972 #if defined(OS_MACOSX) | 1972 #if defined(OS_MACOSX) |
| 1973 base::mac::ScopedNSAutoreleasePool pool; | 1973 base::mac::ScopedNSAutoreleasePool pool; |
| 1974 #endif | 1974 #endif |
| 1975 | 1975 |
| 1976 return base::LaunchUnitTestsSerially( | 1976 return base::LaunchUnitTestsSerially( |
| 1977 argc, | 1977 argc, |
| 1978 argv, | 1978 argv, |
| 1979 base::Bind(&RunHelper, base::Unretained(suite))); | 1979 base::Bind(&RunHelper, base::Unretained(suite))); |
| 1980 } | 1980 } |
| OLD | NEW |