OLD | NEW |
---|---|
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/ui/tabs/tab_strip_model.h" | 5 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 2670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2681 WebContents* moved_contents = strip_src.DetachWebContentsAt(1); | 2681 WebContents* moved_contents = strip_src.DetachWebContentsAt(1); |
2682 EXPECT_EQ(contents2, moved_contents); | 2682 EXPECT_EQ(contents2, moved_contents); |
2683 | 2683 |
2684 // Attach the tab to the destination tab strip. | 2684 // Attach the tab to the destination tab strip. |
2685 strip_dst.AppendWebContents(moved_contents, true); | 2685 strip_dst.AppendWebContents(moved_contents, true); |
2686 EXPECT_TRUE(strip_dst.IsTabBlocked(0)); | 2686 EXPECT_TRUE(strip_dst.IsTabBlocked(0)); |
2687 | 2687 |
2688 strip_dst.CloseAllTabs(); | 2688 strip_dst.CloseAllTabs(); |
2689 strip_src.CloseAllTabs(); | 2689 strip_src.CloseAllTabs(); |
2690 } | 2690 } |
2691 | |
2692 // Verifies ordering of tabs opened via link from a pinned tab with subsequent | |
Peter Kasting
2015/05/11 22:10:32
Nit: link -> a link, with -> with a
sky
2015/05/11 22:13:56
Done.
| |
2693 // pinned tab. | |
2694 TEST_F(TabStripModelTest, LinkClicksWithPinnedTabOrdering) { | |
2695 TabStripDummyDelegate delegate; | |
2696 TabStripModel strip(&delegate, profile()); | |
2697 | |
2698 // Open two pages, pinned. | |
2699 WebContents* page_a_contents = CreateWebContents(); | |
2700 strip.AddWebContents(page_a_contents, -1, | |
2701 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, | |
2702 TabStripModel::ADD_ACTIVE | TabStripModel::ADD_PINNED); | |
2703 WebContents* page_b_contents = CreateWebContents(); | |
2704 strip.AddWebContents(page_b_contents, -1, | |
2705 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, | |
2706 TabStripModel::ADD_ACTIVE | TabStripModel::ADD_PINNED); | |
2707 | |
2708 // Activate the first tab (a). | |
2709 strip.ActivateTabAt(0, true); | |
2710 | |
2711 // Open two more tabs as link clicks. The first tab (c) should appear after | |
2712 // the pinned tabs followed by the second tab (d). | |
2713 WebContents* page_c_contents = CreateWebContents(); | |
2714 WebContents* page_d_contents = CreateWebContents(); | |
2715 strip.AddWebContents(page_c_contents, -1, ui::PAGE_TRANSITION_LINK, | |
2716 TabStripModel::ADD_NONE); | |
2717 strip.AddWebContents(page_d_contents, -1, ui::PAGE_TRANSITION_LINK, | |
2718 TabStripModel::ADD_NONE); | |
2719 | |
2720 EXPECT_EQ(2, strip.GetIndexOfWebContents(page_c_contents)); | |
2721 EXPECT_EQ(3, strip.GetIndexOfWebContents(page_d_contents)); | |
2722 strip.CloseAllTabs(); | |
2723 } | |
OLD | NEW |