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

Unified Diff: tools/telemetry/telemetry/page/actions/navigate_unittest.py

Issue 21174002: Allow defining custom navigation on a per-page basis. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Creating explicit Javascript page action Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/page/actions/navigate_unittest.py
diff --git a/tools/telemetry/telemetry/page/actions/navigate_unittest.py b/tools/telemetry/telemetry/page/actions/navigate_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..bbf0ab63306d7f2268b00acdc74dc31d3bcdd6be
--- /dev/null
+++ b/tools/telemetry/telemetry/page/actions/navigate_unittest.py
@@ -0,0 +1,34 @@
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+
+from telemetry.page import page as page_module
+from telemetry.page.actions import navigate
+from telemetry.unittest import tab_test_case
+
+
+class NavigateActionTest(tab_test_case.TabTestCase):
+ def CreatePageFromUnittestDataDir(self, filename):
+ unittest_data_dir = os.path.join(os.path.dirname(__file__),
+ os.pardir, os.pardir, os.pardir,
+ 'unittest_data')
+ self._browser.SetHTTPServerDirectories(unittest_data_dir)
+ return page_module.Page(
+ self._browser.http_server.UrlOf(filename),
+ None # In this test, we don't need a page set.
dennis_jeffrey 2013/08/14 22:21:04 indent the above 2 lines by 2 more spaces each, si
edmundyan 2013/08/14 23:37:59 Done.
+ )
+
+ def testNavigateAction(self):
+ unittest_data_dir = os.path.join(os.path.dirname(__file__),
+ os.pardir, os.pardir, os.pardir,
+ 'unittest_data')
+ self._browser.SetHTTPServerDirectories(unittest_data_dir)
+
+ page = self.CreatePageFromUnittestDataDir('blank.html')
+ i = navigate.NavigateAction()
+ i.RunAction(page, self._tab, None)
+ self.assertEquals(
+ self._tab.EvaluateJavaScript('document.location.pathname;'),
+ '/blank.html')

Powered by Google App Engine
This is Rietveld 408576698