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

Side by Side Diff: tools/telemetry/telemetry/core/chrome/inspector_page_unittest.py

Issue 12278015: [Telemetry] Reorganize everything. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-add shebangs. Created 7 years, 10 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
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 import os 4 import os
5 5
6 from telemetry import tab_test_case 6 from telemetry.test import tab_test_case
7 7
8 class InspectorPageTest(tab_test_case.TabTestCase): 8 class InspectorPageTest(tab_test_case.TabTestCase):
9 def __init__(self, *args): 9 def __init__(self, *args):
10 super(InspectorPageTest, self).__init__(*args) 10 super(InspectorPageTest, self).__init__(*args)
11 11
12 def testPageNavigateToNormalUrl(self): 12 def testPageNavigateToNormalUrl(self):
13 self._tab.Navigate('http://www.google.com') 13 self._tab.Navigate('http://www.google.com')
14 self._tab.WaitForDocumentReadyStateToBeComplete() 14 self._tab.WaitForDocumentReadyStateToBeComplete()
15 15
16 def testPageNavigateToUrlChanger(self): 16 def testPageNavigateToUrlChanger(self):
17 # The Url that we actually load is http://www.youtube.com/. 17 # The Url that we actually load is http://www.youtube.com/.
18 self._tab.Navigate('http://youtube.com/') 18 self._tab.Navigate('http://youtube.com/')
19 19
20 self._tab.WaitForDocumentReadyStateToBeComplete() 20 self._tab.WaitForDocumentReadyStateToBeComplete()
21 21
22 def testPageNavigateToImpossibleURL(self): 22 def testPageNavigateToImpossibleURL(self):
23 self._tab.Navigate('http://23f09f0f9fsdflajsfaldfkj2f3f.com') 23 self._tab.Navigate('http://23f09f0f9fsdflajsfaldfkj2f3f.com')
24 self._tab.WaitForDocumentReadyStateToBeComplete() 24 self._tab.WaitForDocumentReadyStateToBeComplete()
25 25
26 def testCustomActionToNavigate(self): 26 def testCustomActionToNavigate(self):
27 unittest_data_dir = os.path.join(os.path.dirname(__file__), 27 unittest_data_dir = os.path.join(os.path.dirname(__file__),
28 '..', 'unittest_data') 28 '..', '..', '..', 'unittest_data')
29 self._browser.SetHTTPServerDirectory(unittest_data_dir) 29 self._browser.SetHTTPServerDirectory(unittest_data_dir)
30 self._tab.Navigate( 30 self._tab.Navigate(
31 self._browser.http_server.UrlOf('page_with_link.html')) 31 self._browser.http_server.UrlOf('page_with_link.html'))
32 self._tab.WaitForDocumentReadyStateToBeComplete() 32 self._tab.WaitForDocumentReadyStateToBeComplete()
33 self.assertEquals( 33 self.assertEquals(
34 self._tab.EvaluateJavaScript('document.location.pathname;'), 34 self._tab.EvaluateJavaScript('document.location.pathname;'),
35 '/page_with_link.html') 35 '/page_with_link.html')
36 36
37 custom_action_called = [False] 37 custom_action_called = [False]
38 def CustomAction(): 38 def CustomAction():
39 custom_action_called[0] = True 39 custom_action_called[0] = True
40 self._tab.ExecuteJavaScript('document.getElementById("clickme").click();') 40 self._tab.ExecuteJavaScript('document.getElementById("clickme").click();')
41 41
42 self._tab.PerformActionAndWaitForNavigate(CustomAction) 42 self._tab.PerformActionAndWaitForNavigate(CustomAction)
43 43
44 self.assertTrue(custom_action_called[0]) 44 self.assertTrue(custom_action_called[0])
45 self.assertEquals( 45 self.assertEquals(
46 self._tab.EvaluateJavaScript('document.location.pathname;'), 46 self._tab.EvaluateJavaScript('document.location.pathname;'),
47 '/blank.html') 47 '/blank.html')
48 48
49 def testGetCookieByName(self): 49 def testGetCookieByName(self):
50 unittest_data_dir = os.path.join(os.path.dirname(__file__), 50 unittest_data_dir = os.path.join(os.path.dirname(__file__),
51 '..', 'unittest_data') 51 '..', '..', '..', 'unittest_data')
52 self._browser.SetHTTPServerDirectory(unittest_data_dir) 52 self._browser.SetHTTPServerDirectory(unittest_data_dir)
53 self._tab.Navigate( 53 self._tab.Navigate(
54 self._browser.http_server.UrlOf('blank.html')) 54 self._browser.http_server.UrlOf('blank.html'))
55 self._tab.WaitForDocumentReadyStateToBeComplete() 55 self._tab.WaitForDocumentReadyStateToBeComplete()
56 self._tab.ExecuteJavaScript('document.cookie="foo=bar"') 56 self._tab.ExecuteJavaScript('document.cookie="foo=bar"')
57 self.assertEquals(self._tab.GetCookieByName('foo'), 'bar') 57 self.assertEquals(self._tab.GetCookieByName('foo'), 'bar')
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/core/chrome/inspector_page.py ('k') | tools/telemetry/telemetry/core/chrome/inspector_runtime.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698