| 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 "components/scheduler/base/task_queue_manager.h" | 5 #include "components/scheduler/base/task_queue_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1887 run_loop.Run(); | 1887 run_loop.Run(); |
| 1888 buffer.Finish(); | 1888 buffer.Finish(); |
| 1889 | 1889 |
| 1890 return base::WrapUnique( | 1890 return base::WrapUnique( |
| 1891 trace_analyzer::TraceAnalyzer::Create(trace_output.json_output)); | 1891 trace_analyzer::TraceAnalyzer::Create(trace_output.json_output)); |
| 1892 } | 1892 } |
| 1893 | 1893 |
| 1894 TEST_F(TaskQueueManagerTestWithTracing, BlameContextAttribution) { | 1894 TEST_F(TaskQueueManagerTestWithTracing, BlameContextAttribution) { |
| 1895 using trace_analyzer::Query; | 1895 using trace_analyzer::Query; |
| 1896 | 1896 |
| 1897 Initialize(1u); | 1897 InitializeWithRealMessageLoop(1u); |
| 1898 TaskQueue* queue = runners_[0].get(); | 1898 TaskQueue* queue = runners_[0].get(); |
| 1899 | 1899 |
| 1900 StartTracing(); | 1900 StartTracing(); |
| 1901 { | 1901 { |
| 1902 base::trace_event::BlameContext blame_context("cat", "name", "type", | 1902 base::trace_event::BlameContext blame_context("cat", "name", "type", |
| 1903 "scope", 0, nullptr); | 1903 "scope", 0, nullptr); |
| 1904 blame_context.Initialize(); | 1904 blame_context.Initialize(); |
| 1905 queue->SetBlameContext(&blame_context); | 1905 queue->SetBlameContext(&blame_context); |
| 1906 queue->PostTask(FROM_HERE, base::Bind(&NopTask)); | 1906 queue->PostTask(FROM_HERE, base::Bind(&NopTask)); |
| 1907 test_task_runner_->RunUntilIdle(); | 1907 message_loop_->RunUntilIdle(); |
| 1908 } | 1908 } |
| 1909 StopTracing(); | 1909 StopTracing(); |
| 1910 std::unique_ptr<trace_analyzer::TraceAnalyzer> analyzer = | 1910 std::unique_ptr<trace_analyzer::TraceAnalyzer> analyzer = |
| 1911 CreateTraceAnalyzer(); | 1911 CreateTraceAnalyzer(); |
| 1912 | 1912 |
| 1913 trace_analyzer::TraceEventVector events; | 1913 trace_analyzer::TraceEventVector events; |
| 1914 Query q = Query::EventPhaseIs(TRACE_EVENT_PHASE_ENTER_CONTEXT) || | 1914 Query q = Query::EventPhaseIs(TRACE_EVENT_PHASE_ENTER_CONTEXT) || |
| 1915 Query::EventPhaseIs(TRACE_EVENT_PHASE_LEAVE_CONTEXT); | 1915 Query::EventPhaseIs(TRACE_EVENT_PHASE_LEAVE_CONTEXT); |
| 1916 analyzer->FindEvents(q, &events); | 1916 analyzer->FindEvents(q, &events); |
| 1917 | 1917 |
| 1918 EXPECT_EQ(2u, events.size()); | 1918 EXPECT_EQ(2u, events.size()); |
| 1919 } | 1919 } |
| 1920 | 1920 |
| 1921 } // namespace scheduler | 1921 } // namespace scheduler |
| OLD | NEW |