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..73db13d136a02e3968bdb7f30f4e1325c38852b0 |
--- /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. |
+ ) |
+ |
+ 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') |