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

Side by Side Diff: content/browser/memory/memory_coordinator_browsertest.cc

Issue 2434353003: Introduce MemoryCoordinatorProxy in base (Closed)
Patch Set: Address on reviews 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/memory/memory_coordinator.h" 5 #include "content/browser/memory/memory_coordinator.h"
6 #include "content/browser/browser_main_loop.h" 6 #include "content/browser/browser_main_loop.h"
7 #include "content/public/common/content_features.h" 7 #include "content/public/common/content_features.h"
8 #include "content/public/test/content_browser_test.h" 8 #include "content/public/test/content_browser_test.h"
9 #include "content/public/test/content_browser_test_utils.h" 9 #include "content/public/test/content_browser_test_utils.h"
10 10
11 namespace content { 11 namespace content {
12 12
13 namespace {
14
15 void EnableForTesting() {
16 base::FeatureList::ClearInstanceForTesting();
17 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
18 feature_list->InitializeFromCommandLine(features::kMemoryCoordinator.name,
19 "");
20 base::FeatureList::SetInstance(std::move(feature_list));
21 }
22
23 } // namespace
24
25 class MemoryCoordinatorTest : public ContentBrowserTest { 13 class MemoryCoordinatorTest : public ContentBrowserTest {
26 public: 14 public:
27 MemoryCoordinatorTest() {} 15 MemoryCoordinatorTest() {}
28 16
29 void SetUp() override { 17 void SetUp() override {
30 EnableForTesting(); 18 MemoryCoordinator::EnableFeaturesForTesting();
31 ContentBrowserTest::SetUp(); 19 ContentBrowserTest::SetUp();
32 } 20 }
33 21
34 private: 22 private:
35 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinatorTest); 23 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinatorTest);
36 }; 24 };
37 25
38 // TODO(bashi): Enable this test on macos when MemoryMonitorMac is implemented. 26 // TODO(bashi): Enable this test on macos when MemoryMonitorMac is implemented.
39 #if defined(OS_MACOSX) 27 #if defined(OS_MACOSX)
40 #define MAYBE_HandleAdded DISABLED_HandleAdded 28 #define MAYBE_HandleAdded DISABLED_HandleAdded
41 #else 29 #else
42 #define MAYBE_HandleAdded HandleAdded 30 #define MAYBE_HandleAdded HandleAdded
43 #endif 31 #endif
44 IN_PROC_BROWSER_TEST_F(MemoryCoordinatorTest, MAYBE_HandleAdded) { 32 IN_PROC_BROWSER_TEST_F(MemoryCoordinatorTest, MAYBE_HandleAdded) {
45 GURL url = GetTestUrl("", "simple_page.html"); 33 GURL url = GetTestUrl("", "simple_page.html");
46 NavigateToURL(shell(), url); 34 NavigateToURL(shell(), url);
47 EXPECT_EQ(1u, MemoryCoordinator::GetInstance()->NumChildrenForTesting()); 35 EXPECT_EQ(1u, MemoryCoordinator::GetInstance()->NumChildrenForTesting());
48 } 36 }
49 37
50 } // namespace content 38 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698