OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "base/macros.h" | 5 #include "base/macros.h" |
6 #include "chrome/browser/browser_process.h" | 6 #include "chrome/browser/browser_process.h" |
7 #include "chrome/browser/memory/tab_manager.h" | 7 #include "chrome/browser/resource_coordinator/tab_manager.h" |
8 #include "chrome/browser/memory/tab_manager_observer.h" | 8 #include "chrome/browser/resource_coordinator/tab_manager_observer.h" |
9 #include "chrome/browser/memory/tab_manager_web_contents_data.h" | 9 #include "chrome/browser/resource_coordinator/tab_manager_web_contents_data.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 11 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
12 #include "chrome/common/url_constants.h" | 12 #include "chrome/common/url_constants.h" |
13 #include "chrome/test/base/in_process_browser_test.h" | 13 #include "chrome/test/base/in_process_browser_test.h" |
14 #include "content/public/test/test_utils.h" | 14 #include "content/public/test/test_utils.h" |
15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
16 | 16 |
17 using content::OpenURLParams; | 17 using content::OpenURLParams; |
18 using content::WebContents; | 18 using content::WebContents; |
19 | 19 |
20 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) | 20 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) |
21 | 21 |
22 namespace memory { | 22 namespace resource_coordinator { |
23 | 23 |
24 class TabManagerObserverTest : public InProcessBrowserTest { | 24 class TabManagerObserverTest : public InProcessBrowserTest { |
25 public: | 25 public: |
26 TabManagerObserverTest() {} | 26 TabManagerObserverTest() {} |
27 | 27 |
28 // Helper functions. | 28 // Helper functions. |
29 void set_tab_strip_model(TabStripModel* tsm) { tab_strip_model_ = tsm; } | 29 void set_tab_strip_model(TabStripModel* tsm) { tab_strip_model_ = tsm; } |
30 | 30 |
31 int GetIndex(WebContents* contents) { | 31 int GetIndex(WebContents* contents) { |
32 return tab_strip_model_->GetIndexOfWebContents(contents); | 32 return tab_strip_model_->GetIndexOfWebContents(contents); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 tab_manager->SetTabAutoDiscardableState(contents, false); | 177 tab_manager->SetTabAutoDiscardableState(contents, false); |
178 EXPECT_EQ(1, observer.nb_events()); | 178 EXPECT_EQ(1, observer.nb_events()); |
179 | 179 |
180 // Change it back and we should have another event. | 180 // Change it back and we should have another event. |
181 tab_manager->SetTabAutoDiscardableState(contents, true); | 181 tab_manager->SetTabAutoDiscardableState(contents, true); |
182 EXPECT_EQ(2, observer.nb_events()); | 182 EXPECT_EQ(2, observer.nb_events()); |
183 EXPECT_TRUE(observer.is_auto_discardable()); | 183 EXPECT_TRUE(observer.is_auto_discardable()); |
184 EXPECT_EQ(ContentsId(contents), ContentsId(observer.content())); | 184 EXPECT_EQ(ContentsId(contents), ContentsId(observer.content())); |
185 } | 185 } |
186 | 186 |
187 } // namespace memory | 187 } // namespace resource_coordinator |
188 | 188 |
189 #endif // OS_WIN || OS_MAXOSX || OS_LINUX | 189 #endif // OS_WIN || OS_MAXOSX || OS_LINUX |
OLD | NEW |