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

Side by Side Diff: tools/perf/profile_creators/cookie_profile_extender_unittest.py

Issue 1115383002: Disable failing telemetry unit tests on chromeos. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: perf2 Created 5 years, 7 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
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 import sqlite3
6 import tempfile 5 import tempfile
7 import unittest 6 import unittest
8 7
8 try:
9 import sqlite3
10 except ImportError:
11 sqlite3 = None
cylee1 2015/05/04 11:16:59 How does it different from just "pass" since nobod
achuithb 2015/05/04 19:48:00 Done. This test is running on the device, and sql
12
13 from telemetry import decorators
9 from profile_creators.cookie_profile_extender import CookieProfileExtender 14 from profile_creators.cookie_profile_extender import CookieProfileExtender
10 15
11 16
12 # Testing private method. 17 # Testing private method.
13 # pylint: disable=protected-access 18 # pylint: disable=protected-access
14 class CookieProfileExtenderTest(unittest.TestCase): 19 class CookieProfileExtenderTest(unittest.TestCase):
15 def _CreateCookieTable(self, path): 20 def _CreateCookieTable(self, path):
16 connection = sqlite3.connect(path) 21 connection = sqlite3.connect(path)
17 cursor = connection.cursor() 22 cursor = connection.cursor()
18 cursor.execute("CREATE TABLE cookies (url text)") 23 cursor.execute("CREATE TABLE cookies (url text)")
19 connection.commit() 24 connection.commit()
20 connection.close() 25 connection.close()
21 26
22 def _AddCookiesToTable(self, path, count): 27 def _AddCookiesToTable(self, path, count):
23 connection = sqlite3.connect(path) 28 connection = sqlite3.connect(path)
24 cursor = connection.cursor() 29 cursor = connection.cursor()
25 for i in range(count): 30 for i in range(count):
26 cursor.execute("INSERT INTO cookies VALUES ('%s')" % i) 31 cursor.execute("INSERT INTO cookies VALUES ('%s')" % i)
27 connection.commit() 32 connection.commit()
28 connection.close() 33 connection.close()
29 34
35 @decorators.Disabled('chromeos') # crbug.com/483212
30 def testCookieCount(self): 36 def testCookieCount(self):
31 # Neither tempfile.TemporaryFile() nor tempfile.NamedTemporaryFile() work 37 # Neither tempfile.TemporaryFile() nor tempfile.NamedTemporaryFile() work
32 # well here. The former doesn't work at all, since it doesn't gaurantee a 38 # well here. The former doesn't work at all, since it doesn't gaurantee a
33 # file-system visible path. The latter doesn't work well, since the 39 # file-system visible path. The latter doesn't work well, since the
34 # returned file cannot be opened a second time on Windows. The returned 40 # returned file cannot be opened a second time on Windows. The returned
35 # file would have to be closed, and the method would need to be called with 41 # file would have to be closed, and the method would need to be called with
36 # Delete=False, which makes its functionality no simpler than 42 # Delete=False, which makes its functionality no simpler than
37 # tempfile.mkstemp(). 43 # tempfile.mkstemp().
38 handle, path = tempfile.mkstemp() 44 handle, path = tempfile.mkstemp()
39 try: 45 try:
40 os.close(handle) 46 os.close(handle)
41 47
42 self._CreateCookieTable(path) 48 self._CreateCookieTable(path)
43 self.assertEquals(CookieProfileExtender._CookieCountInDB(path), 0) 49 self.assertEquals(CookieProfileExtender._CookieCountInDB(path), 0)
44 50
45 self._AddCookiesToTable(path, 100) 51 self._AddCookiesToTable(path, 100)
46 self.assertEquals(CookieProfileExtender._CookieCountInDB(path), 100) 52 self.assertEquals(CookieProfileExtender._CookieCountInDB(path), 100)
47 finally: 53 finally:
48 os.remove(path) 54 os.remove(path)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698