| 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 "tools/cygprofile/cygprofile.h" | 5 #include "tools/cygprofile/cygprofile.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <sys/time.h> | 8 #include <sys/time.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 const LogEntry& second_entry = entries[1]; | 54 const LogEntry& second_entry = entries[1]; |
| 55 ASSERT_EQ(1U, reinterpret_cast<uintptr_t>(second_entry.address)); | 55 ASSERT_EQ(1U, reinterpret_cast<uintptr_t>(second_entry.address)); |
| 56 ASSERT_EQ(first_entry.pid, second_entry.pid); | 56 ASSERT_EQ(first_entry.pid, second_entry.pid); |
| 57 ASSERT_EQ(first_entry.tid, second_entry.tid); | 57 ASSERT_EQ(first_entry.tid, second_entry.tid); |
| 58 | 58 |
| 59 ASSERT_GE(GetUsecSecTimeFromTimeSpec(second_entry.time), | 59 ASSERT_GE(GetUsecSecTimeFromTimeSpec(second_entry.time), |
| 60 GetUsecSecTimeFromTimeSpec(first_entry.time)); | 60 GetUsecSecTimeFromTimeSpec(first_entry.time)); |
| 61 } | 61 } |
| 62 | 62 |
| 63 TEST(CygprofileTest, ManagerBasic) { | 63 TEST(CygprofileTest, ManagerBasic) { |
| 64 base::WaitableEvent wait_event(true, false); | 64 base::WaitableEvent wait_event( |
| 65 base::WaitableEvent notify_event(true, false); | 65 base::WaitableEvent::ResetPolicy::MANUAL, |
| 66 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 67 base::WaitableEvent notify_event( |
| 68 base::WaitableEvent::ResetPolicy::MANUAL, |
| 69 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 66 | 70 |
| 67 ThreadLogsManager manager( | 71 ThreadLogsManager manager( |
| 68 base::Bind(&base::WaitableEvent::Wait, base::Unretained(&wait_event)), | 72 base::Bind(&base::WaitableEvent::Wait, base::Unretained(&wait_event)), |
| 69 base::Bind(&base::WaitableEvent::Signal, | 73 base::Bind(&base::WaitableEvent::Signal, |
| 70 base::Unretained(¬ify_event))); | 74 base::Unretained(¬ify_event))); |
| 71 | 75 |
| 72 std::vector<LogEntry> entries; | 76 std::vector<LogEntry> entries; |
| 73 std::unique_ptr<ThreadLog> thread_log( | 77 std::unique_ptr<ThreadLog> thread_log( |
| 74 new ThreadLog(base::Bind(&FlushEntries, base::Unretained(&entries)))); | 78 new ThreadLog(base::Bind(&FlushEntries, base::Unretained(&entries)))); |
| 75 | 79 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 93 } | 97 } |
| 94 | 98 |
| 95 } // namespace | 99 } // namespace |
| 96 } // namespace cygprofile | 100 } // namespace cygprofile |
| 97 | 101 |
| 98 // Custom runner implementation since base's one requires JNI on Android. | 102 // Custom runner implementation since base's one requires JNI on Android. |
| 99 int main(int argc, char** argv) { | 103 int main(int argc, char** argv) { |
| 100 testing::InitGoogleTest(&argc, argv); | 104 testing::InitGoogleTest(&argc, argv); |
| 101 return RUN_ALL_TESTS(); | 105 return RUN_ALL_TESTS(); |
| 102 } | 106 } |
| OLD | NEW |