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

Unified Diff: base/trace_event/memory_dump_manager_unittest.cc

Issue 1028333002: Chromium -> Mojo roll. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 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/trace_event/memory_dump_manager.cc ('k') | base/trace_event/memory_dump_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/memory_dump_manager_unittest.cc
diff --git a/base/trace_event/memory_dump_manager_unittest.cc b/base/trace_event/memory_dump_manager_unittest.cc
index 251a92adadf252cad9c7cb26a4ff54202ad668b8..65e719f00461be0ec43efd4158f18ba36d5bc743 100644
--- a/base/trace_event/memory_dump_manager_unittest.cc
+++ b/base/trace_event/memory_dump_manager_unittest.cc
@@ -10,6 +10,7 @@
#include "testing/gtest/include/gtest/gtest.h"
using testing::_;
+using testing::Invoke;
using testing::Return;
namespace base {
@@ -51,6 +52,14 @@ class MockDumpProvider : public MemoryDumpProvider {
public:
MOCK_METHOD1(DumpInto, bool(ProcessMemoryDump* pmd));
+ // DumpInto() override for the ActiveDumpProviderConsistency test,
+ bool DumpIntoAndCheckDumpProviderCurrentlyActive(ProcessMemoryDump* pmd) {
+ EXPECT_EQ(
+ this,
+ MemoryDumpManager::GetInstance()->dump_provider_currently_active());
+ return true;
+ }
+
const char* GetFriendlyName() const override { return "MockDumpProvider"; }
};
@@ -148,5 +157,30 @@ TEST_F(MemoryDumpManagerTest, DisableFailingDumpers) {
DisableTracing();
}
+// TODO(primiano): remove once crbug.com/466121 gets fixed.
+// Ascertains that calls to MDM::dump_provider_currently_active() actually
+// returns the MemoryDumpProvider currently active during the DumpInto() call.
+TEST_F(MemoryDumpManagerTest, ActiveDumpProviderConsistency) {
+ MockDumpProvider mdp1;
+ MockDumpProvider mdp2;
+
+ mdm_->RegisterDumpProvider(&mdp1);
+ mdm_->RegisterDumpProvider(&mdp2);
+ EnableTracing(kTraceCategory);
+ EXPECT_CALL(mdp1, DumpInto(_))
+ .Times(2)
+ .WillRepeatedly(Invoke(
+ &mdp1,
+ &MockDumpProvider::DumpIntoAndCheckDumpProviderCurrentlyActive));
+ EXPECT_CALL(mdp2, DumpInto(_))
+ .Times(2)
+ .WillRepeatedly(Invoke(
+ &mdp2,
+ &MockDumpProvider::DumpIntoAndCheckDumpProviderCurrentlyActive));
+ mdm_->RequestDumpPoint(DumpPointType::EXPLICITLY_TRIGGERED);
+ mdm_->RequestDumpPoint(DumpPointType::EXPLICITLY_TRIGGERED);
+ DisableTracing();
+}
+
} // namespace trace_event
} // namespace base
« no previous file with comments | « base/trace_event/memory_dump_manager.cc ('k') | base/trace_event/memory_dump_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698