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

Unified Diff: base/profiler/stack_sampling_profiler_unittest.cc

Issue 2702463003: NativeStackSampler implementation for Mac. (Closed)
Patch Set: fix for test Created 3 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 | « base/profiler/native_stack_sampler_mac.cc ('k') | chrome/common/stack_sampling_configuration.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/profiler/stack_sampling_profiler_unittest.cc
diff --git a/base/profiler/stack_sampling_profiler_unittest.cc b/base/profiler/stack_sampling_profiler_unittest.cc
index 0b300d575d73c76f65a6afd7e53a372020a844a3..226c7d051e3678b6786c597dd6c81de3feb66640 100644
--- a/base/profiler/stack_sampling_profiler_unittest.cc
+++ b/base/profiler/stack_sampling_profiler_unittest.cc
@@ -12,6 +12,7 @@
#include "base/bind.h"
#include "base/compiler_specific.h"
+#include "base/files/file_util.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
@@ -38,8 +39,8 @@
#endif
// STACK_SAMPLING_PROFILER_SUPPORTED is used to conditionally enable the tests
-// below for supported platforms (currently Win x64).
-#if defined(_WIN64)
+// below for supported platforms (currently Win x64 and Mac x64).
+#if defined(_WIN64) || defined(OS_MACOSX)
#define STACK_SAMPLING_PROFILER_SUPPORTED 1
#endif
@@ -306,6 +307,8 @@ void SynchronousUnloadNativeLibrary(NativeLibrary library) {
::GetLastError() != ERROR_MOD_NOT_FOUND) {
PlatformThread::Sleep(TimeDelta::FromMilliseconds(1));
}
+#elif defined(OS_MACOSX)
+ // Unloading a library on the Mac is synchronous.
#else
NOTIMPLEMENTED();
#endif
@@ -542,7 +545,7 @@ void TestLibraryUnload(bool wait_until_unloaded) {
<< "Stack:\n"
<< FormatSampleForDiagnosticOutput(sample, profile.modules);
} else {
- // We didn't wait for the asynchonous unloading to complete, so the results
+ // We didn't wait for the asynchronous unloading to complete, so the results
// are non-deterministic: if the library finished unloading we should have
// the same stack as |wait_until_unloaded|, if not we should have the full
// stack. The important thing is that we should not crash.
@@ -622,7 +625,8 @@ TEST(StackSamplingProfilerTest, MAYBE_Basic) {
<< FormatSampleForDiagnosticOutput(sample, profile.modules);
FilePath executable_path;
EXPECT_TRUE(PathService::Get(FILE_EXE, &executable_path));
- EXPECT_EQ(executable_path, profile.modules[loc->module_index].filename);
+ EXPECT_EQ(executable_path,
+ MakeAbsoluteFilePath(profile.modules[loc->module_index].filename));
}
// Checks that annotations are recorded in samples.
@@ -1003,7 +1007,8 @@ TEST(StackSamplingProfilerTest, MAYBE_OtherLibrary) {
// Checks that a stack that runs through a library that is unloading produces a
// stack, and doesn't crash.
-#if defined(STACK_SAMPLING_PROFILER_SUPPORTED)
+// Unloading is synchronous on the Mac, so this test is inapplicable.
+#if defined(STACK_SAMPLING_PROFILER_SUPPORTED) && !defined(OS_MACOSX)
#define MAYBE_UnloadingLibrary UnloadingLibrary
#else
#define MAYBE_UnloadingLibrary DISABLED_UnloadingLibrary
« no previous file with comments | « base/profiler/native_stack_sampler_mac.cc ('k') | chrome/common/stack_sampling_configuration.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698