| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <cstdlib> | 8 #include <cstdlib> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 // TargetThread::OtherLibraryCallback | 540 // TargetThread::OtherLibraryCallback |
| 541 EXPECT_EQ(2, sample.frames.end() - end_frame) | 541 EXPECT_EQ(2, sample.frames.end() - end_frame) |
| 542 << "Stack:\n" | 542 << "Stack:\n" |
| 543 << FormatSampleForDiagnosticOutput(sample, profile.modules); | 543 << FormatSampleForDiagnosticOutput(sample, profile.modules); |
| 544 } else { | 544 } else { |
| 545 // We didn't wait for the asynchonous unloading to complete, so the results | 545 // We didn't wait for the asynchonous unloading to complete, so the results |
| 546 // are non-deterministic: if the library finished unloading we should have | 546 // are non-deterministic: if the library finished unloading we should have |
| 547 // the same stack as |wait_until_unloaded|, if not we should have the full | 547 // the same stack as |wait_until_unloaded|, if not we should have the full |
| 548 // stack. The important thing is that we should not crash. | 548 // stack. The important thing is that we should not crash. |
| 549 | 549 |
| 550 if ((sample.frames.end() - 1) - end_frame == 2) { | 550 if (sample.frames.end() - end_frame == 2) { |
| 551 // This is the same case as |wait_until_unloaded|. | 551 // This is the same case as |wait_until_unloaded|. |
| 552 return; | 552 return; |
| 553 } | 553 } |
| 554 | 554 |
| 555 // Check that the stack contains a frame for | 555 // Check that the stack contains a frame for |
| 556 // TargetThread::CallThroughOtherLibrary(). | 556 // TargetThread::CallThroughOtherLibrary(). |
| 557 Frames::const_iterator other_library_frame = FindFirstFrameWithinFunction( | 557 Frames::const_iterator other_library_frame = FindFirstFrameWithinFunction( |
| 558 sample, &TargetThread::CallThroughOtherLibrary); | 558 sample, &TargetThread::CallThroughOtherLibrary); |
| 559 ASSERT_TRUE(other_library_frame != sample.frames.end()) | 559 ASSERT_TRUE(other_library_frame != sample.frames.end()) |
| 560 << "Function at " | 560 << "Function at " |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 #if defined(STACK_SAMPLING_PROFILER_SUPPORTED) | 1017 #if defined(STACK_SAMPLING_PROFILER_SUPPORTED) |
| 1018 #define MAYBE_UnloadedLibrary UnloadedLibrary | 1018 #define MAYBE_UnloadedLibrary UnloadedLibrary |
| 1019 #else | 1019 #else |
| 1020 #define MAYBE_UnloadedLibrary DISABLED_UnloadedLibrary | 1020 #define MAYBE_UnloadedLibrary DISABLED_UnloadedLibrary |
| 1021 #endif | 1021 #endif |
| 1022 TEST(StackSamplingProfilerTest, MAYBE_UnloadedLibrary) { | 1022 TEST(StackSamplingProfilerTest, MAYBE_UnloadedLibrary) { |
| 1023 TestLibraryUnload(true); | 1023 TestLibraryUnload(true); |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 } // namespace base | 1026 } // namespace base |
| OLD | NEW |