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

Unified Diff: chrome/browser/task_manager/providers/arc/arc_process_filter_unittest.cc

Issue 2655633002: [task_manager] Add ARC process whitelist. (Closed)
Patch Set: Address comments. Created 3 years, 11 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: chrome/browser/task_manager/providers/arc/arc_process_filter_unittest.cc
diff --git a/chrome/browser/task_manager/providers/arc/arc_process_filter_unittest.cc b/chrome/browser/task_manager/providers/arc/arc_process_filter_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f26ae4d6953aecd22df8abe59f6f98047ceb2162
--- /dev/null
+++ b/chrome/browser/task_manager/providers/arc/arc_process_filter_unittest.cc
@@ -0,0 +1,55 @@
+// Copyright 2017 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 "chrome/browser/task_manager/providers/arc/arc_process_filter.h"
+
+#include <string>
+
+#include "chrome/browser/chromeos/arc/process/arc_process.h"
+#include "components/arc/common/process.mojom.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace task_manager {
+
+namespace {
+
+const arc::ArcProcess kTest1Process(0 /* nspid */,
+ 0 /* pid */,
+ "/system/test1_process",
+ arc::mojom::ProcessState::PERSISTENT,
+ false /* is_focused */,
+ 0 /* last_activity_time */);
+
+const arc::ArcProcess kTest2Process(0 /* nspid */,
+ 0 /* pid */,
+ "/system/test2_process",
+ arc::mojom::ProcessState::PERSISTENT,
+ false /* is_focused */,
+ 0 /* last_activity_time */);
+
+const arc::ArcProcess kTopProcess(0 /* nspid */,
+ 0 /* pid */,
+ "top_process",
+ arc::mojom::ProcessState::TOP,
+ false /* is_focused */,
+ 0 /* last_activity_time */);
+
+} // namespace
+
+using ArcProcessFilterTest = testing::Test;
+
+TEST_F(ArcProcessFilterTest, ExplicitWhitelist) {
+ ArcProcessFilter filter({"/system/test1_process", "test"});
+ EXPECT_TRUE(filter.ShouldDisplayProcess(kTest1Process));
+ EXPECT_FALSE(filter.ShouldDisplayProcess(kTest2Process));
+}
+
+TEST_F(ArcProcessFilterTest, ProcessStateFiltering) {
+ ArcProcessFilter filter;
+ EXPECT_FALSE(filter.ShouldDisplayProcess(kTest1Process));
+ EXPECT_FALSE(filter.ShouldDisplayProcess(kTest2Process));
+ EXPECT_TRUE(filter.ShouldDisplayProcess(kTopProcess));
+}
+
+} // namespace task_manager

Powered by Google App Engine
This is Rietveld 408576698