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

Unified Diff: components/tracing/child_trace_message_filter_unittest.cc

Issue 2028043002: tracing: restructure to the components/tracing folder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
Index: components/tracing/child_trace_message_filter_unittest.cc
diff --git a/components/tracing/child_trace_message_filter_unittest.cc b/components/tracing/child_trace_message_filter_unittest.cc
deleted file mode 100644
index 3c4a768e26833982802918e9cccb8e5e221c9ff8..0000000000000000000000000000000000000000
--- a/components/tracing/child_trace_message_filter_unittest.cc
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2015 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 "components/tracing/child_trace_message_filter.h"
-
-#include <memory>
-
-#include "base/memory/ref_counted.h"
-#include "base/message_loop/message_loop.h"
-#include "components/tracing/tracing_messages.h"
-#include "ipc/ipc_message.h"
-#include "ipc/ipc_sender.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace tracing {
-
-class FakeSender : public IPC::Sender {
- public:
- FakeSender() {}
-
- ~FakeSender() override {}
-
- bool Send(IPC::Message* msg) override {
- last_message_.reset(msg);
- return true;
- }
-
- std::unique_ptr<IPC::Message> last_message_;
-};
-
-class ChildTraceMessageFilterTest : public testing::Test {
- public:
- ChildTraceMessageFilterTest() {
- message_filter_ =
- new tracing::ChildTraceMessageFilter(message_loop_.task_runner().get());
- message_filter_->SetSenderForTesting(&fake_sender_);
- }
-
- void OnSetUMACallback(const std::string& histogram,
- int low,
- int high,
- bool repeat) {
- fake_sender_.last_message_.reset();
- message_filter_->OnSetUMACallback(histogram, low, high, repeat);
- }
-
- base::MessageLoop message_loop_;
- FakeSender fake_sender_;
- scoped_refptr<tracing::ChildTraceMessageFilter> message_filter_;
-};
-
-TEST_F(ChildTraceMessageFilterTest, TestHistogramDoesNotTrigger) {
- LOCAL_HISTOGRAM_COUNTS("foo1", 10);
-
- OnSetUMACallback("foo1", 20000, 25000, true);
-
- message_loop_.RunUntilIdle();
-
- EXPECT_FALSE(fake_sender_.last_message_);
-}
-
-TEST_F(ChildTraceMessageFilterTest, TestHistogramTriggers) {
- LOCAL_HISTOGRAM_COUNTS("foo2", 2);
-
- OnSetUMACallback("foo2", 1, 3, true);
-
- message_loop_.RunUntilIdle();
-
- EXPECT_TRUE(fake_sender_.last_message_);
- EXPECT_EQ(fake_sender_.last_message_->type(),
- TracingHostMsg_TriggerBackgroundTrace::ID);
-}
-
-TEST_F(ChildTraceMessageFilterTest, TestHistogramAborts) {
- LOCAL_HISTOGRAM_COUNTS("foo3", 10);
-
- OnSetUMACallback("foo3", 1, 3, false);
-
- message_loop_.RunUntilIdle();
-
- EXPECT_TRUE(fake_sender_.last_message_);
- EXPECT_EQ(fake_sender_.last_message_->type(),
- TracingHostMsg_AbortBackgroundTrace::ID);
-}
-
-} // namespace tracing

Powered by Google App Engine
This is Rietveld 408576698