| OLD | NEW |
| 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 |
| 7 #include "base/test/scoped_feature_list.h" |
| 6 #include "content/browser/browser_main_loop.h" | 8 #include "content/browser/browser_main_loop.h" |
| 7 #include "content/public/common/content_features.h" | 9 #include "content/public/common/content_features.h" |
| 8 #include "content/public/test/content_browser_test.h" | 10 #include "content/public/test/content_browser_test.h" |
| 9 #include "content/public/test/content_browser_test_utils.h" | 11 #include "content/public/test/content_browser_test_utils.h" |
| 10 | 12 |
| 11 namespace content { | 13 namespace content { |
| 12 | 14 |
| 13 class MemoryCoordinatorTest : public ContentBrowserTest { | 15 class MemoryCoordinatorTest : public ContentBrowserTest { |
| 14 public: | 16 public: |
| 15 MemoryCoordinatorTest() {} | 17 MemoryCoordinatorTest() {} |
| 16 | 18 |
| 17 void SetUp() override { | 19 void SetUp() override { |
| 18 MemoryCoordinator::EnableFeaturesForTesting(); | 20 scoped_feature_list_.InitAndEnableFeature(features::kMemoryCoordinator); |
| 19 ContentBrowserTest::SetUp(); | 21 ContentBrowserTest::SetUp(); |
| 20 } | 22 } |
| 21 | 23 |
| 22 private: | 24 private: |
| 25 base::test::ScopedFeatureList scoped_feature_list_; |
| 26 |
| 23 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinatorTest); | 27 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinatorTest); |
| 24 }; | 28 }; |
| 25 | 29 |
| 26 // TODO(bashi): Enable this test on macos when MemoryMonitorMac is implemented. | 30 // TODO(bashi): Enable this test on macos when MemoryMonitorMac is implemented. |
| 27 #if defined(OS_MACOSX) | 31 #if defined(OS_MACOSX) |
| 28 #define MAYBE_HandleAdded DISABLED_HandleAdded | 32 #define MAYBE_HandleAdded DISABLED_HandleAdded |
| 29 #else | 33 #else |
| 30 #define MAYBE_HandleAdded HandleAdded | 34 #define MAYBE_HandleAdded HandleAdded |
| 31 #endif | 35 #endif |
| 32 IN_PROC_BROWSER_TEST_F(MemoryCoordinatorTest, MAYBE_HandleAdded) { | 36 IN_PROC_BROWSER_TEST_F(MemoryCoordinatorTest, MAYBE_HandleAdded) { |
| 33 GURL url = GetTestUrl("", "simple_page.html"); | 37 GURL url = GetTestUrl("", "simple_page.html"); |
| 34 NavigateToURL(shell(), url); | 38 NavigateToURL(shell(), url); |
| 35 EXPECT_EQ(1u, MemoryCoordinator::GetInstance()->NumChildrenForTesting()); | 39 EXPECT_EQ(1u, MemoryCoordinator::GetInstance()->NumChildrenForTesting()); |
| 36 } | 40 } |
| 37 | 41 |
| 38 } // namespace content | 42 } // namespace content |
| OLD | NEW |