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: content/public/test/memory_coordinator_test_utils.cc

Issue 2466883002: Add TabLoaderTest (Closed)
Patch Set: (rebase) Created 4 years, 1 month 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/public/test/memory_coordinator_test_utils.cc
diff --git a/content/public/test/memory_coordinator_test_utils.cc b/content/public/test/memory_coordinator_test_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..891976f4011faecb66cdc512159df95109a475f8
--- /dev/null
+++ b/content/public/test/memory_coordinator_test_utils.cc
@@ -0,0 +1,32 @@
+// Copyright 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/public/test/memory_coordinator_test_utils.h"
+
+#include "base/memory/memory_coordinator_proxy.h"
+#include "content/browser/memory/memory_coordinator.h"
+#include "content/public/common/content_features.h"
+
+namespace content {
+
+void EnableMemoryCoordinatorFeaturesForTesting() {
+ base::FeatureList::ClearInstanceForTesting();
+ std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
+ feature_list->InitializeFromCommandLine(features::kMemoryCoordinator.name,
+ "");
+ base::FeatureList::SetInstance(std::move(feature_list));
+}
+
+void SetUpMemoryCoordinatorProxyForTesting() {
+ base::MemoryCoordinatorProxy::GetInstance()->
+ SetGetCurrentMemoryStateCallback(base::Bind(
+ &content::MemoryCoordinator::GetCurrentMemoryState,
+ base::Unretained(content::MemoryCoordinator::GetInstance())));
+ base::MemoryCoordinatorProxy::GetInstance()->
+ SetSetCurrentMemoryStateForTestingCallback(base::Bind(
+ &content::MemoryCoordinator::SetCurrentMemoryStateForTesting,
+ base::Unretained(content::MemoryCoordinator::GetInstance())));
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698