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

Side by Side Diff: chrome/browser/memory/tab_manager_unittest.cc

Issue 2034573002: [Cleanup] Factor out common code. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wherein we relearn that "commit -a" doesn't add new files. Created 4 years, 6 months 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/memory/tab_manager.h" 5 #include "chrome/browser/memory/tab_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 EXPECT_EQ(kPlayingAudio, test_list[index++].child_process_host_id); 295 EXPECT_EQ(kPlayingAudio, test_list[index++].child_process_host_id);
296 EXPECT_EQ(kPinned, test_list[index++].child_process_host_id); 296 EXPECT_EQ(kPinned, test_list[index++].child_process_host_id);
297 EXPECT_EQ(kOldButPinned, test_list[index++].child_process_host_id); 297 EXPECT_EQ(kOldButPinned, test_list[index++].child_process_host_id);
298 EXPECT_EQ(kApp, test_list[index++].child_process_host_id); 298 EXPECT_EQ(kApp, test_list[index++].child_process_host_id);
299 EXPECT_EQ(kRecent, test_list[index++].child_process_host_id); 299 EXPECT_EQ(kRecent, test_list[index++].child_process_host_id);
300 EXPECT_EQ(kOld, test_list[index++].child_process_host_id); 300 EXPECT_EQ(kOld, test_list[index++].child_process_host_id);
301 EXPECT_EQ(kReallyOld, test_list[index++].child_process_host_id); 301 EXPECT_EQ(kReallyOld, test_list[index++].child_process_host_id);
302 EXPECT_EQ(kInternalPage, test_list[index++].child_process_host_id); 302 EXPECT_EQ(kInternalPage, test_list[index++].child_process_host_id);
303 } 303 }
304 304
305 TEST_F(TabManagerTest, IsInternalPage) {
306 EXPECT_TRUE(TabManager::IsInternalPage(GURL(chrome::kChromeUIDownloadsURL)));
307 EXPECT_TRUE(TabManager::IsInternalPage(GURL(chrome::kChromeUIHistoryURL)));
308 EXPECT_TRUE(TabManager::IsInternalPage(GURL(chrome::kChromeUINewTabURL)));
309 EXPECT_TRUE(TabManager::IsInternalPage(GURL(chrome::kChromeUISettingsURL)));
310
311 // Debugging URLs are not included.
312 #if defined(OS_CHROMEOS)
313 EXPECT_FALSE(TabManager::IsInternalPage(GURL(chrome::kChromeUIDiscardsURL)));
314 #endif
315 EXPECT_FALSE(
316 TabManager::IsInternalPage(GURL(chrome::kChromeUINetInternalsURL)));
317
318 // Prefix matches are included.
319 EXPECT_TRUE(
320 TabManager::IsInternalPage(GURL("chrome://settings/fakeSetting")));
321 }
322
323 // Ensures discarding tabs leaves TabStripModel in a good state. 305 // Ensures discarding tabs leaves TabStripModel in a good state.
324 TEST_F(TabManagerTest, DiscardWebContentsAt) { 306 TEST_F(TabManagerTest, DiscardWebContentsAt) {
325 TabManager tab_manager; 307 TabManager tab_manager;
326 308
327 TabStripDummyDelegate delegate; 309 TabStripDummyDelegate delegate;
328 TabStripModel tabstrip(&delegate, profile()); 310 TabStripModel tabstrip(&delegate, profile());
329 tabstrip.AddObserver(&tab_manager); 311 tabstrip.AddObserver(&tab_manager);
330 312
331 // Fill it with some tabs. 313 // Fill it with some tabs.
332 WebContents* contents1 = CreateWebContents(); 314 WebContents* contents1 = CreateWebContents();
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 EXPECT_EQ(0u, task_runner->size()); 633 EXPECT_EQ(0u, task_runner->size());
652 EXPECT_EQ(0u, tm.notified_renderers_.size()); 634 EXPECT_EQ(0u, tm.notified_renderers_.size());
653 635
654 636
655 // Clean up the tabstrip. 637 // Clean up the tabstrip.
656 tabstrip.CloseAllTabs(); 638 tabstrip.CloseAllTabs();
657 ASSERT_TRUE(tabstrip.empty()); 639 ASSERT_TRUE(tabstrip.empty());
658 } 640 }
659 641
660 } // namespace memory 642 } // namespace memory
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698