Commit 654481e2 authored by nednguyen's avatar nednguyen Committed by Commit bot

[Telemetry] Remove Page.TransferToPageSet method.

This method is never used. It was introduced as a way to conveniently share pages among page sets. The implementation
is not correct as archive_data_file is defined in page_set.

In the future, sharing pages among pageset should be simple
when we can remove the page's dependence on pageset (https://code.google.com/p/chromium/issues/detail?id=466836)

Review URL: https://codereview.chromium.org/1033493003

Cr-Commit-Position: refs/heads/master@{#322661}
parent 4557699f
......@@ -76,26 +76,6 @@ class Page(user_story.UserStory):
if startup_url_scheme == 'file':
raise ValueError('startup_url with local file scheme is not supported')
def TransferToPageSet(self, another_page_set):
""" Transfer this page to another page set.
Args:
another_page_set: an instance of telemetry.page.PageSet to transfer this
page to.
Note:
This method removes this page instance from the pages list of its current
page_set, so one should be careful not to iterate through the list of
pages of a page_set and calling this method.
For example, the below loop is erroneous:
for p in page_set_A.pages:
p.TransferToPageSet(page_set_B.pages)
"""
assert self._page_set
if another_page_set is self._page_set:
return
self._page_set.pages.remove(self)
self._page_set = another_page_set
self._page_set.AddUserStory(self)
def RunNavigateSteps(self, action_runner):
url = self.file_path_url_with_scheme if self.is_file else self.url
action_runner.Navigate(
......
......@@ -43,24 +43,3 @@ class TestPageSet(unittest.TestCase):
real_absolute_dir]))
finally:
os.rmdir(directory_path)
def testFormingPageSetFromSubPageSet(self):
page_set_a = page_set.PageSet()
pages = [
page.Page('http://foo.com', page_set_a),
page.Page('http://bar.com', page_set_a),
]
for p in pages:
page_set_a.AddUserStory(p)
# Form page_set_b from sub page_set_a.
page_set_b = page_set.PageSet()
for p in pages:
p.TransferToPageSet(page_set_b)
page_set_b.AddUserStory(page.Page('http://baz.com', page_set_b))
self.assertEqual(0, len(page_set_a.pages))
self.assertEqual(
set(['http://foo.com', 'http://bar.com', 'http://baz.com']),
set(p.url for p in page_set_b.pages))
for p in page_set_b.pages:
self.assertIs(page_set_b, p.page_set)
......@@ -147,22 +147,6 @@ class TestPage(unittest.TestCase):
'name': 'Example'
}, named_dict)
def testTransferToPageSet(self):
page_set_a = page_set.PageSet()
page_set_b = page_set.PageSet()
page_foo = page.Page('http://foo.com', page_set_a)
page_bar = page.Page('http://bar.com', page_set_a)
page_baz = page.Page('http://baz.com', page_set_a)
page_set_a.AddUserStory(page_foo)
page_set_a.AddUserStory(page_bar)
page_set_a.AddUserStory(page_baz)
page_bar.TransferToPageSet(page_set_b)
self.assertEqual([page_foo, page_baz], page_set_a.pages)
self.assertEqual([page_bar], page_set_b.pages)
self.assertIs(page_set_b, page_bar.page_set)
def testIsLocal(self):
p = page.Page('file://foo.html')
self.assertTrue(p.is_local)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment