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

Unified Diff: content/browser/memory/memory_monitor_android_unittest.cc

Issue 2340293003: Add MemoryMonitorAndroid (Closed)
Patch Set: typo Created 4 years, 3 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: content/browser/memory/memory_monitor_android_unittest.cc
diff --git a/content/browser/memory/memory_monitor_android_unittest.cc b/content/browser/memory/memory_monitor_android_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4b4195c5a087a76eb8f20965c3d81b1949dade0e
--- /dev/null
+++ b/content/browser/memory/memory_monitor_android_unittest.cc
@@ -0,0 +1,31 @@
+// Copyright (c) 2016 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 "content/browser/memory/memory_monitor_android.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace content {
+
+class MemoryMonitorAndroidTest : public testing::Test {
+ public:
+ MemoryMonitorAndroidTest() : monitor_(MemoryMonitorAndroid::Create()) {}
+
+ protected:
+ std::unique_ptr<MemoryMonitorAndroid> monitor_;
+};
+
+TEST_F(MemoryMonitorAndroidTest, CanGetMemoryInfo) {
+ EXPECT_TRUE(monitor_->CanGetMemoryInfo());
+}
+
+TEST_F(MemoryMonitorAndroidTest, GetMemoryInfo) {
+ MemoryMonitorAndroid::MemoryInfo info;
+ monitor_->GetMemoryInfo(&info);
+ EXPECT_GT(info.avail_mem, 0);
+ EXPECT_GT(info.threshold, 0);
+ EXPECT_GT(info.total_mem, 0);
+}
chrisha 2016/09/26 17:56:48 A test of the actual GetFreeMemoryUntilCriticalMb
bashi 2016/09/26 23:30:19 In this test, GetFreeMemoryUntilCriticalMb() retur
chrisha 2016/09/27 15:47:16 I'd prefer we use a mock and test the actual logic
bashi 2016/09/29 01:24:21 Working on this. https://codereview.chromium.org/2
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698