| OLD | NEW |
| 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 logging |
| 4 import unittest | 5 import unittest |
| 5 | 6 |
| 6 from telemetry.core import browser_finder | 7 from telemetry.core import browser_finder |
| 7 from telemetry.test import options_for_unittests | 8 from telemetry.test import options_for_unittests |
| 8 | 9 |
| 9 class BrowserTest(unittest.TestCase): | 10 class BrowserTest(unittest.TestCase): |
| 10 def testBrowserCreation(self): | 11 def testBrowserCreation(self): |
| 11 options = options_for_unittests.GetCopy() | 12 options = options_for_unittests.GetCopy() |
| 12 browser_to_create = browser_finder.FindBrowser(options) | 13 browser_to_create = browser_finder.FindBrowser(options) |
| 13 if not browser_to_create: | 14 if not browser_to_create: |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 77 |
| 77 def testCloseReferencedTab(self): | 78 def testCloseReferencedTab(self): |
| 78 options = options_for_unittests.GetCopy() | 79 options = options_for_unittests.GetCopy() |
| 79 browser_to_create = browser_finder.FindBrowser(options) | 80 browser_to_create = browser_finder.FindBrowser(options) |
| 80 with browser_to_create.Create() as b: | 81 with browser_to_create.Create() as b: |
| 81 b.tabs.New() | 82 b.tabs.New() |
| 82 tab = b.tabs[0] | 83 tab = b.tabs[0] |
| 83 tab.Navigate('http://www.google.com/') | 84 tab.Navigate('http://www.google.com/') |
| 84 tab.Close() | 85 tab.Close() |
| 85 self.assertEquals(1, len(b.tabs)) | 86 self.assertEquals(1, len(b.tabs)) |
| 87 |
| 88 def testDirtyProfileCreation(self): |
| 89 options = options_for_unittests.GetCopy() |
| 90 |
| 91 # Dirty profile creation is currently only implemented on Desktop. |
| 92 is_running_on_desktop = not ( |
| 93 options.browser.startswith('android') or |
| 94 options.browser.startswith('cros')) |
| 95 if not is_running_on_desktop: |
| 96 logging.warn("Desktop-only test, skipping.") |
| 97 return |
| 98 |
| 99 options.profile_type = 'small_profile' |
| 100 browser_to_create = browser_finder.FindBrowser(options) |
| 101 with browser_to_create.Create() as b: |
| 102 self.assertEquals(1, len(b.tabs)) |
| OLD | NEW |