| 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 unittest | 4 import unittest |
| 5 import browser | 5 import browser |
| 6 import browser_options | 6 import browser_options |
| 7 import desktop_browser_finder | 7 import desktop_browser_finder |
| 8 import os as real_os | 8 import os as real_os |
| 9 | 9 |
| 10 # This file verifies the logic for finding a browser instance on all platforms | 10 # This file verifies the logic for finding a browser instance on all platforms |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 return len([x for x in array if x.type == type]) != 0 | 86 return len([x for x in array if x.type == type]) != 0 |
| 87 | 87 |
| 88 class OSXFindTest(FindTestBase): | 88 class OSXFindTest(FindTestBase): |
| 89 def setUp(self): | 89 def setUp(self): |
| 90 super(OSXFindTest, self).setUp() | 90 super(OSXFindTest, self).setUp() |
| 91 self._sys_stub.platform = 'darwin' | 91 self._sys_stub.platform = 'darwin' |
| 92 self._files.append("/Applications/Google Chrome Canary.app/" | 92 self._files.append("/Applications/Google Chrome Canary.app/" |
| 93 "Contents/MacOS/Google Chrome Canary") | 93 "Contents/MacOS/Google Chrome Canary") |
| 94 self._files.append("/Applications/Google Chrome.app/" + | 94 self._files.append("/Applications/Google Chrome.app/" + |
| 95 "Contents/MacOS/Google Chrome") | 95 "Contents/MacOS/Google Chrome") |
| 96 self._files.append( |
| 97 "../../../out/Release/Chromium.app/Contents/MacOS/Chromium") |
| 98 self._files.append( |
| 99 "../../../out/Debug/Chromium.app/Contents/MacOS/Chromium") |
| 100 self._files.append( |
| 101 "../../../out/Release/Content Shell.app/Contents/MacOS/Content Shell") |
| 102 self._files.append( |
| 103 "../../../out/Debug/Content Shell.app/Contents/MacOS/Content Shell") |
| 96 | 104 |
| 97 def testFindCanaryWithBothPresent(self): | 105 def testFindAll(self): |
| 98 types = self.DoFindAllTypes() | 106 types = self.DoFindAllTypes() |
| 99 assert 'canary' in types | 107 self.assertEquals( |
| 100 assert 'system' in types | 108 set(types), |
| 101 assert len(types) == 2 | 109 set(['debug', 'release', |
| 102 | 110 'content-shell-debug', 'content-shell-release', |
| 103 def testFind(self): | 111 'canary', 'system'])) |
| 104 browsers = self.DoFindAll() | |
| 105 self.assertTrue(has_type(browsers, 'canary')) | |
| 106 self.assertTrue(has_type(browsers, 'system')) | |
| 107 | |
| 108 del self._files[0] | |
| 109 browsers = self.DoFindAll() | |
| 110 self.assertFalse(has_type(browsers, 'canary')) | |
| 111 self.assertTrue(has_type(browsers, 'system')) | |
| 112 | 112 |
| 113 | 113 |
| 114 class LinuxFindTest(FindTestBase): | 114 class LinuxFindTest(FindTestBase): |
| 115 def setUp(self): | 115 def setUp(self): |
| 116 super(LinuxFindTest, self).setUp() | 116 super(LinuxFindTest, self).setUp() |
| 117 | 117 |
| 118 self._sys_stub.platform = 'linux2' | 118 self._sys_stub.platform = 'linux2' |
| 119 self._files.append("/foo/chrome") | 119 self._files.append("/foo/chrome") |
| 120 self._files.append("../../../out/Release/chrome") | 120 self._files.append("../../../out/Release/chrome") |
| 121 self._files.append("../../../out/Debug/chrome") | 121 self._files.append("../../../out/Debug/chrome") |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 def testFindAllWithExact(self): | 184 def testFindAllWithExact(self): |
| 185 self._options.browser_executable = 'c:\\tmp\\chrome.exe' | 185 self._options.browser_executable = 'c:\\tmp\\chrome.exe' |
| 186 types = self.DoFindAllTypes() | 186 types = self.DoFindAllTypes() |
| 187 self.assertEquals( | 187 self.assertEquals( |
| 188 set(types), | 188 set(types), |
| 189 set(['exact', | 189 set(['exact', |
| 190 'debug', 'release', | 190 'debug', 'release', |
| 191 'content-shell-debug', 'content-shell-release', | 191 'content-shell-debug', 'content-shell-release', |
| 192 'system', 'canary'])) | 192 'system', 'canary'])) |
| OLD | NEW |