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 "chrome/browser/sessions/tab_loader.h" | 5 #include "chrome/browser/sessions/tab_loader.h" |
6 | 6 |
7 #include "base/memory/memory_coordinator_proxy.h" | 7 #include "base/memory/memory_coordinator_client_registry.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/test/scoped_feature_list.h" | 9 #include "base/test/scoped_feature_list.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "chrome/test/base/testing_profile.h" | 11 #include "chrome/test/base/testing_profile.h" |
12 #include "content/public/browser/memory_coordinator_delegate.h" | 12 #include "content/public/browser/memory_coordinator_delegate.h" |
13 #include "content/public/browser/render_widget_host_view.h" | 13 #include "content/public/browser/render_widget_host_view.h" |
14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
15 #include "content/public/common/content_features.h" | 15 #include "content/public/common/content_features.h" |
16 #include "content/public/test/memory_coordinator_test_utils.h" | 16 #include "content/public/test/memory_coordinator_test_utils.h" |
17 #include "content/public/test/test_browser_thread_bundle.h" | 17 #include "content/public/test/test_browser_thread_bundle.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // TODO(hajimehoshi): Enable this test on macos when MemoryMonitorMac is | 55 // TODO(hajimehoshi): Enable this test on macos when MemoryMonitorMac is |
56 // implemented. | 56 // implemented. |
57 #if defined(OS_MACOSX) | 57 #if defined(OS_MACOSX) |
58 #define MAYBE_OnMemoryStateChange DISABLED_OnMemoryStateChange | 58 #define MAYBE_OnMemoryStateChange DISABLED_OnMemoryStateChange |
59 #else | 59 #else |
60 #define MAYBE_OnMemoryStateChange OnMemoryStateChange | 60 #define MAYBE_OnMemoryStateChange OnMemoryStateChange |
61 #endif | 61 #endif |
62 TEST_F(TabLoaderTest, MAYBE_OnMemoryStateChange) { | 62 TEST_F(TabLoaderTest, MAYBE_OnMemoryStateChange) { |
63 TabLoader::RestoreTabs(restored_tabs_, base::TimeTicks()); | 63 TabLoader::RestoreTabs(restored_tabs_, base::TimeTicks()); |
64 EXPECT_TRUE(TabLoader::shared_tab_loader_->loading_enabled_); | 64 EXPECT_TRUE(TabLoader::shared_tab_loader_->loading_enabled_); |
65 base::MemoryCoordinatorProxy::GetInstance()->SetCurrentMemoryStateForTesting( | 65 base::MemoryCoordinatorClientRegistry::GetInstance()->Notify( |
66 base::MemoryState::THROTTLED); | 66 base::MemoryState::THROTTLED); |
67 // ObserverListThreadsafe is used to notify the state to clients, so running | 67 // ObserverListThreadsafe is used to notify the state to clients, so running |
68 // the loop is necessary here. | 68 // the loop is necessary here. |
69 base::RunLoop loop; | 69 base::RunLoop loop; |
70 loop.RunUntilIdle(); | 70 loop.RunUntilIdle(); |
71 EXPECT_FALSE(TabLoader::shared_tab_loader_->loading_enabled_); | 71 EXPECT_FALSE(TabLoader::shared_tab_loader_->loading_enabled_); |
72 } | 72 } |
OLD | NEW |