forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
memlog: Basic end-to-end test framework.
This set up test stubs for all 3 major modes of memlog. Currently it only tests that the system doesn't crash, and that the ProfilingProcessHost is only started when the flags are passed. Note, this test is focused on ONLY the memlog interface. ProfilingProcessHost may eventually evolved into hosting other types of profiling services thus the test is named for Memlog and not PPH. Also, with this CL is a shutdown crash fix for MemlogClient being deleted on the wrong thread. Bug: 753218 Change-Id: I37111b7a61d9a4c18b37680b3216975be2d0535c Reviewed-on: https://chromium-review.googlesource.com/644608 Commit-Queue: Brett Wilson <brettw@chromium.org> Reviewed-by: Erik Chen <erikchen@chromium.org> Reviewed-by: Brett Wilson <brettw@chromium.org> Reviewed-by: Albert J. Wong <ajwong@chromium.org> Cr-Commit-Position: refs/heads/master@{#499103}
- Loading branch information
Brett Wilson
authored and
Commit Bot
committed
Sep 1, 2017
1 parent
c5484d8
commit 69cf473
Showing
9 changed files
with
94 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright (c) 2012 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "base/allocator/features.h" | ||
#include "chrome/browser/profiling_host/profiling_process_host.h" | ||
#include "chrome/common/chrome_switches.h" | ||
#include "chrome/test/base/in_process_browser_test.h" | ||
#include "content/public/test/browser_test.h" | ||
#include "testing/gtest/include/gtest/gtest.h" | ||
|
||
// Some builds don't support the allocator shim in which case the memory long | ||
// won't function. | ||
#if BUILDFLAG(USE_ALLOCATOR_SHIM) | ||
|
||
namespace { | ||
|
||
class MemlogBrowserTest : public InProcessBrowserTest, | ||
public testing::WithParamInterface<const char*> { | ||
protected: | ||
void SetUpDefaultCommandLine(base::CommandLine* command_line) override { | ||
InProcessBrowserTest::SetUpDefaultCommandLine(command_line); | ||
if (GetParam()) | ||
command_line->AppendSwitchASCII(switches::kMemlog, GetParam()); | ||
} | ||
}; | ||
|
||
IN_PROC_BROWSER_TEST_P(MemlogBrowserTest, EndToEnd) { | ||
if (!GetParam()) { | ||
// Test that nothing has been started if the flag is not passed. | ||
ASSERT_FALSE(profiling::ProfilingProcessHost::has_started()); | ||
} else { | ||
ASSERT_TRUE(profiling::ProfilingProcessHost::has_started()); | ||
} | ||
} | ||
|
||
INSTANTIATE_TEST_CASE_P(NoMemlog, | ||
MemlogBrowserTest, | ||
::testing::Values(static_cast<const char*>(nullptr))); | ||
INSTANTIATE_TEST_CASE_P(BrowserOnly, | ||
MemlogBrowserTest, | ||
::testing::Values(switches::kMemlogModeBrowser)); | ||
INSTANTIATE_TEST_CASE_P(AllProcesses, | ||
MemlogBrowserTest, | ||
::testing::Values(switches::kMemlogModeAll)); | ||
|
||
} // namespace | ||
|
||
#endif // BUILDFLAG(USE_ALLOCATOR_SHIM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters