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

Side by Side Diff: chrome/test/functional/ntp.py

Issue 10050016: Removes pinning code from TopSites as we no longer need it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove printfs Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/pref_names.cc ('k') | chrome/test/pyautolib/pyauto.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import copy 6 import copy
7 import os 7 import os
8 8
9 import pyauto_functional # Must be imported before pyauto 9 import pyauto_functional # Must be imported before pyauto
10 import pyauto 10 import pyauto
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 self.RemoveNTPDefaultThumbnails() 93 self.RemoveNTPDefaultThumbnails()
94 self.assertFalse(self.GetNTPThumbnails()) 94 self.assertFalse(self.GetNTPThumbnails())
95 95
96 def testOneMostVisitedSite(self): 96 def testOneMostVisitedSite(self):
97 """Tests that a site is added to the most visited sites""" 97 """Tests that a site is added to the most visited sites"""
98 self.RemoveNTPDefaultThumbnails() 98 self.RemoveNTPDefaultThumbnails()
99 self.NavigateToURL(self.PAGES[1]['url']) 99 self.NavigateToURL(self.PAGES[1]['url'])
100 thumbnail = self.GetNTPThumbnails()[0] 100 thumbnail = self.GetNTPThumbnails()[0]
101 self.assertEqual(self.PAGES[1]['url'], thumbnail['url']) 101 self.assertEqual(self.PAGES[1]['url'], thumbnail['url'])
102 self.assertEqual(self.PAGES[1]['title'], thumbnail['title']) 102 self.assertEqual(self.PAGES[1]['title'], thumbnail['title'])
103 self.assertFalse(thumbnail['is_pinned'])
104 103
105 def testMoveThumbnailBasic(self): 104 def testMoveThumbnailBasic(self):
106 """Tests moving a thumbnail to a different index""" 105 """Tests moving a thumbnail to a different index"""
107 self.RemoveNTPDefaultThumbnails() 106 self.RemoveNTPDefaultThumbnails()
108 self.NavigateToURL(self.PAGES[0]['url']) 107 self.NavigateToURL(self.PAGES[0]['url'])
109 self.NavigateToURL(self.PAGES[1]['url']) 108 self.NavigateToURL(self.PAGES[1]['url'])
110 thumbnails = self.GetNTPThumbnails() 109 thumbnails = self.GetNTPThumbnails()
111 self.MoveNTPThumbnail(thumbnails[0], 1) 110 self.MoveNTPThumbnail(thumbnails[0], 1)
112 self.assertTrue(self.IsNTPThumbnailPinned(thumbnails[0]))
113 self.assertFalse(self.IsNTPThumbnailPinned(thumbnails[1]))
114 self.assertEqual(self.PAGES[0]['url'], self.GetNTPThumbnails()[1]['url']) 111 self.assertEqual(self.PAGES[0]['url'], self.GetNTPThumbnails()[1]['url'])
115 self.assertEqual(1, self.GetNTPThumbnailIndex(thumbnails[0])) 112 self.assertEqual(1, self.GetNTPThumbnailIndex(thumbnails[0]))
116 113
117 def testPinningThumbnailBasic(self):
118 """Tests that we can pin/unpin a thumbnail"""
119 self.RemoveNTPDefaultThumbnails()
120 self.NavigateToURL(self.PAGES[0]['url'])
121 thumbnail1 = self.GetNTPThumbnails()[0]
122 self.assertFalse(self.IsNTPThumbnailPinned(thumbnail1))
123 self.PinNTPThumbnail(thumbnail1)
124 self.assertTrue(self.IsNTPThumbnailPinned(thumbnail1))
125 self.UnpinNTPThumbnail(thumbnail1)
126 self.assertFalse(self.IsNTPThumbnailPinned(thumbnail1))
127
128 def testRemoveThumbnail(self): 114 def testRemoveThumbnail(self):
129 """Tests removing a thumbnail works""" 115 """Tests removing a thumbnail works"""
130 self.RemoveNTPDefaultThumbnails() 116 self.RemoveNTPDefaultThumbnails()
131 for page in self.PAGES: 117 for page in self.PAGES:
132 self.AppendTab(pyauto.GURL(page['url'])) 118 self.AppendTab(pyauto.GURL(page['url']))
133 119
134 thumbnails = self.GetNTPThumbnails() 120 thumbnails = self.GetNTPThumbnails()
135 for thumbnail in thumbnails: 121 for thumbnail in thumbnails:
136 self.assertEquals(thumbnail, self.GetNTPThumbnails()[0]) 122 self.assertEquals(thumbnail, self.GetNTPThumbnails()[0])
137 self.RemoveNTPThumbnail(thumbnail) 123 self.RemoveNTPThumbnail(thumbnail)
138 self.assertFalse(self._NTPContainsThumbnail(thumbnail)) 124 self.assertFalse(self._NTPContainsThumbnail(thumbnail))
139 self.assertFalse(self.GetNTPThumbnails()) 125 self.assertFalse(self.GetNTPThumbnails())
140 126
141 def testIncognitoNotAppearInMostVisited(self): 127 def testIncognitoNotAppearInMostVisited(self):
142 """Tests that visiting a page in incognito mode does cause it to appear in 128 """Tests that visiting a page in incognito mode does cause it to appear in
143 the Most Visited section""" 129 the Most Visited section"""
144 self.RemoveNTPDefaultThumbnails() 130 self.RemoveNTPDefaultThumbnails()
145 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) 131 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW)
146 self.NavigateToURL(self.PAGES[0]['url'], 1, 0) 132 self.NavigateToURL(self.PAGES[0]['url'], 1, 0)
147 self.assertFalse(self.GetNTPThumbnails()) 133 self.assertFalse(self.GetNTPThumbnails())
148 134
149 def testDifferentProfileNotAppearInMostVisited(self): 135 def testDifferentProfileNotAppearInMostVisited(self):
150 """Tests that visiting a page in one profile does not cause it to appear in 136 """Tests that visiting a page in one profile does not cause it to appear in
151 the Most Visited section of another.""" 137 the Most Visited section of another."""
152 self.RemoveNTPDefaultThumbnails() 138 self.RemoveNTPDefaultThumbnails()
153 self.OpenNewBrowserWindowWithNewProfile() 139 self.OpenNewBrowserWindowWithNewProfile()
154 self.NavigateToURL(self.PAGES[0]['url'], 1, 0) 140 self.NavigateToURL(self.PAGES[0]['url'], 1, 0)
155 self.assertFalse(self.GetNTPThumbnails()) 141 self.assertFalse(self.GetNTPThumbnails())
156 142
157 def testRestoreOncePinnedThumbnail(self):
158 """Tests that after restoring a once pinned thumbnail, the thumbnail is
159 not pinned"""
160 self.RemoveNTPDefaultThumbnails()
161 self.NavigateToURL(self.PAGES[0]['url'])
162 thumbnail1 = self.GetNTPThumbnails()[0]
163 self.PinNTPThumbnail(thumbnail1)
164 self.RemoveNTPThumbnail(thumbnail1)
165 self.RestoreAllNTPThumbnails()
166 self.RemoveNTPDefaultThumbnails()
167 self.assertFalse(self.IsNTPThumbnailPinned(thumbnail1))
168
169 def testThumbnailPersistence(self): 143 def testThumbnailPersistence(self):
170 """Tests that thumbnails persist across Chrome restarts""" 144 """Tests that thumbnails persist across Chrome restarts"""
171 self.RemoveNTPDefaultThumbnails() 145 self.RemoveNTPDefaultThumbnails()
172 for page in self.PAGES: 146 for page in self.PAGES:
173 self.AppendTab(pyauto.GURL(page['url'])) 147 self.AppendTab(pyauto.GURL(page['url']))
174 thumbnails = self.GetNTPThumbnails() 148 thumbnails = self.GetNTPThumbnails()
175 self.MoveNTPThumbnail(thumbnails[0], 1) 149 self.MoveNTPThumbnail(thumbnails[0], 1)
176 thumbnails = self.GetNTPThumbnails() 150 thumbnails = self.GetNTPThumbnails()
177 151
178 self.RestartBrowser(clear_profile=False) 152 self.RestartBrowser(clear_profile=False)
(...skipping 17 matching lines...) Expand all
196 for page in self.PAGES: 170 for page in self.PAGES:
197 self.AppendTab(pyauto.GURL(page['url'])) 171 self.AppendTab(pyauto.GURL(page['url']))
198 thumbnails = self.GetNTPThumbnails() 172 thumbnails = self.GetNTPThumbnails()
199 self.assertEqual(self.PAGES[0]['url'], self.GetNTPThumbnails()[0]['url']) 173 self.assertEqual(self.PAGES[0]['url'], self.GetNTPThumbnails()[0]['url'])
200 self.AppendTab(pyauto.GURL(self.PAGES[1]['url'])) 174 self.AppendTab(pyauto.GURL(self.PAGES[1]['url']))
201 self.assertEqual(self.PAGES[1]['url'], self.GetNTPThumbnails()[0]['url']) 175 self.assertEqual(self.PAGES[1]['url'], self.GetNTPThumbnails()[0]['url'])
202 self.AppendTab(pyauto.GURL(self.PAGES[0]['url'])) 176 self.AppendTab(pyauto.GURL(self.PAGES[0]['url']))
203 self.AppendTab(pyauto.GURL(self.PAGES[0]['url'])) 177 self.AppendTab(pyauto.GURL(self.PAGES[0]['url']))
204 self.assertEqual(self.PAGES[0]['url'], self.GetNTPThumbnails()[0]['url']) 178 self.assertEqual(self.PAGES[0]['url'], self.GetNTPThumbnails()[0]['url'])
205 179
206 def testPinnedThumbnailNeverMoves(self):
207 """Tests that once a thumnail is pinned it never moves"""
208 self.RemoveNTPDefaultThumbnails()
209 for page in self.PAGES:
210 self.AppendTab(pyauto.GURL(page['url']))
211 self.PinNTPThumbnail(self.GetNTPThumbnails()[0])
212 thumbnails = self.GetNTPThumbnails()
213 self.AppendTab(pyauto.GURL(self.PAGES[1]['url']))
214 self.assertEqual(thumbnails, self.GetNTPThumbnails())
215
216 def testThumbnailTitleChangeAfterPageTitleChange(self): 180 def testThumbnailTitleChangeAfterPageTitleChange(self):
217 """Tests that once a page title changes, the thumbnail title changes too""" 181 """Tests that once a page title changes, the thumbnail title changes too"""
218 self.RemoveNTPDefaultThumbnails() 182 self.RemoveNTPDefaultThumbnails()
219 self.NavigateToURL(self.PAGES[0]['url']) 183 self.NavigateToURL(self.PAGES[0]['url'])
220 self.assertEqual(self.PAGES[0]['title'], 184 self.assertEqual(self.PAGES[0]['title'],
221 self.GetNTPThumbnails()[0]['title']) 185 self.GetNTPThumbnails()[0]['title'])
222 self.ExecuteJavascript('window.domAutomationController.send(' + 186 self.ExecuteJavascript('window.domAutomationController.send(' +
223 'document.title = "new title")') 187 'document.title = "new title")')
224 self.assertEqual('new title', self.GetNTPThumbnails()[0]['title']) 188 self.assertEqual('new title', self.GetNTPThumbnails()[0]['title'])
225 189
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 info = self.GetBrowserInfo() 476 info = self.GetBrowserInfo()
513 self.assertTrue(len(info['windows']) == 2, 477 self.assertTrue(len(info['windows']) == 2,
514 msg='A second window does not exist.') 478 msg='A second window does not exist.')
515 actual_tab_url = info['windows'][1]['tabs'][0]['url'] 479 actual_tab_url = info['windows'][1]['tabs'][0]['url']
516 expected_app_url_start = 'chrome-extension://' + installed_app_id 480 expected_app_url_start = 'chrome-extension://' + installed_app_id
517 self.assertTrue(actual_tab_url.startswith(expected_app_url_start), 481 self.assertTrue(actual_tab_url.startswith(expected_app_url_start),
518 msg='The app was not launched in the new window.') 482 msg='The app was not launched in the new window.')
519 483
520 if __name__ == '__main__': 484 if __name__ == '__main__':
521 pyauto_functional.Main() 485 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « chrome/common/pref_names.cc ('k') | chrome/test/pyautolib/pyauto.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698