OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/system_monitor.h" | 5 #include "app/system_monitor.h" |
6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 // Whether to report that we need to run an unload listener before closing. | 98 // Whether to report that we need to run an unload listener before closing. |
99 bool run_unload_; | 99 bool run_unload_; |
100 | 100 |
101 DISALLOW_COPY_AND_ASSIGN(TabStripDummyDelegate); | 101 DISALLOW_COPY_AND_ASSIGN(TabStripDummyDelegate); |
102 }; | 102 }; |
103 | 103 |
104 class TabStripModelTest : public RenderViewHostTestHarness { | 104 class TabStripModelTest : public RenderViewHostTestHarness { |
105 public: | 105 public: |
106 TabContents* CreateTabContents() { | 106 TabContents* CreateTabContents() { |
107 return new TabContents(profile(), NULL, 0, NULL); | 107 return new TabContents(profile(), NULL, 0, NULL, NULL); |
108 } | 108 } |
109 | 109 |
110 TabContents* CreateTabContentsWithSharedRPH(TabContents* tab_contents) { | 110 TabContents* CreateTabContentsWithSharedRPH(TabContents* tab_contents) { |
111 TabContents* retval = new TabContents(profile(), | 111 TabContents* retval = new TabContents(profile(), |
112 tab_contents->render_view_host()->site_instance(), MSG_ROUTING_NONE, | 112 tab_contents->render_view_host()->site_instance(), MSG_ROUTING_NONE, |
113 NULL); | 113 NULL, NULL); |
114 EXPECT_EQ(retval->GetRenderProcessHost(), | 114 EXPECT_EQ(retval->GetRenderProcessHost(), |
115 tab_contents->GetRenderProcessHost()); | 115 tab_contents->GetRenderProcessHost()); |
116 return retval; | 116 return retval; |
117 } | 117 } |
118 | 118 |
119 // Forwards a URL "load" request through to our dummy TabContents | 119 // Forwards a URL "load" request through to our dummy TabContents |
120 // implementation. | 120 // implementation. |
121 void LoadURL(TabContents* con, const std::wstring& url) { | 121 void LoadURL(TabContents* con, const std::wstring& url) { |
122 controller().LoadURL(GURL(WideToUTF16(url)), GURL(), PageTransition::LINK); | 122 controller().LoadURL(GURL(WideToUTF16(url)), GURL(), PageTransition::LINK); |
123 } | 123 } |
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1165 EXPECT_EQ(homepage_contents, tabstrip.GetSelectedTabContents()); | 1165 EXPECT_EQ(homepage_contents, tabstrip.GetSelectedTabContents()); |
1166 | 1166 |
1167 EXPECT_EQ(1, tabstrip.count()); | 1167 EXPECT_EQ(1, tabstrip.count()); |
1168 | 1168 |
1169 tabstrip.CloseAllTabs(); | 1169 tabstrip.CloseAllTabs(); |
1170 EXPECT_TRUE(tabstrip.empty()); | 1170 EXPECT_TRUE(tabstrip.empty()); |
1171 } | 1171 } |
1172 | 1172 |
1173 // Added for http://b/issue?id=958960 | 1173 // Added for http://b/issue?id=958960 |
1174 TEST_F(TabStripModelTest, AppendContentsReselectionTest) { | 1174 TEST_F(TabStripModelTest, AppendContentsReselectionTest) { |
1175 TabContents fake_destinations_tab(profile(), NULL, 0, NULL); | 1175 TabContents fake_destinations_tab(profile(), NULL, 0, NULL, NULL); |
1176 TabStripDummyDelegate delegate(&fake_destinations_tab); | 1176 TabStripDummyDelegate delegate(&fake_destinations_tab); |
1177 TabStripModel tabstrip(&delegate, profile()); | 1177 TabStripModel tabstrip(&delegate, profile()); |
1178 EXPECT_TRUE(tabstrip.empty()); | 1178 EXPECT_TRUE(tabstrip.empty()); |
1179 | 1179 |
1180 // Open the Home Page | 1180 // Open the Home Page |
1181 TabContents* homepage_contents = CreateTabContents(); | 1181 TabContents* homepage_contents = CreateTabContents(); |
1182 tabstrip.AddTabContents( | 1182 tabstrip.AddTabContents( |
1183 homepage_contents, -1, PageTransition::AUTO_BOOKMARK, | 1183 homepage_contents, -1, PageTransition::AUTO_BOOKMARK, |
1184 TabStripModel::ADD_SELECTED); | 1184 TabStripModel::ADD_SELECTED); |
1185 | 1185 |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1984 TabStripModelObserver::REPLACE_MATCH_PREVIEW); | 1984 TabStripModelObserver::REPLACE_MATCH_PREVIEW); |
1985 | 1985 |
1986 ASSERT_EQ(1, tabstrip_observer.GetStateCount()); | 1986 ASSERT_EQ(1, tabstrip_observer.GetStateCount()); |
1987 | 1987 |
1988 state = State(new_contents, 1, MockTabStripModelObserver::REPLACED); | 1988 state = State(new_contents, 1, MockTabStripModelObserver::REPLACED); |
1989 state.src_contents = third_contents; | 1989 state.src_contents = third_contents; |
1990 EXPECT_TRUE(tabstrip_observer.StateEquals(0, state)); | 1990 EXPECT_TRUE(tabstrip_observer.StateEquals(0, state)); |
1991 | 1991 |
1992 strip.CloseAllTabs(); | 1992 strip.CloseAllTabs(); |
1993 } | 1993 } |
OLD | NEW |