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

Unified Diff: client/dom/scripts/database_test.py

Issue 9845043: Rename client/{dom,html} to lib/{dom,html} . (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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
« no previous file with comments | « client/dom/scripts/database.py ('k') | client/dom/scripts/databasebuilder.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/dom/scripts/database_test.py
===================================================================
--- client/dom/scripts/database_test.py (revision 5796)
+++ client/dom/scripts/database_test.py (working copy)
@@ -1,93 +0,0 @@
-#!/usr/bin/python
-# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-# for details. All rights reserved. Use of this source code is governed by a
-# BSD-style license that can be found in the LICENSE file.
-
-"""Tests for database module."""
-
-import logging.config
-import os.path
-import shutil
-import tempfile
-import unittest
-import database
-import idlnode
-import idlparser
-
-
-class DatabaseTestCase(unittest.TestCase):
-
- def _ParseInterface(self, content):
- ast = self._idl_parser.parse(content)
- return idlnode.IDLFile(ast).interfaces[0]
-
- def _ListInterfaces(self, db):
- res = []
- for interface in db.GetInterfaces():
- name = interface.id
- res.append(name)
- return res
-
- def setUp(self):
- self._idl_parser = idlparser.IDLParser(idlparser.FREMONTCUT_SYNTAX)
-
- working_dir = tempfile.mkdtemp()
- self._database_dir = os.path.join(working_dir, 'database')
- self.assertFalse(os.path.exists(self._database_dir))
-
- # Create database and add one interface.
- db = database.Database(self._database_dir)
- interface = self._ParseInterface('interface I1 {};')
- db.AddInterface(interface)
- db.Save()
- self.assertTrue(
- os.path.exists(os.path.join(self._database_dir, 'I1.idl')))
-
- def tearDown(self):
- shutil.rmtree(self._database_dir)
-
- def testCreate(self):
- self.assertTrue(os.path.exists(self._database_dir))
-
- def testListInterfaces(self):
- db = database.Database(self._database_dir)
- db.Load()
- self.assertEquals(self._ListInterfaces(db), ['I1'])
-
- def testHasInterface(self):
- db = database.Database(self._database_dir)
- db.Load()
- self.assertTrue(db.HasInterface('I1'))
- self.assertFalse(db.HasInterface('I2'))
-
- def testAddInterface(self):
- db = database.Database(self._database_dir)
- db.Load()
- interface = self._ParseInterface('interface I2 {};')
- db.AddInterface(interface)
- db.Save()
- self.assertTrue(
- os.path.exists(os.path.join(self._database_dir, 'I2.idl')))
- self.assertEquals(self._ListInterfaces(db),
- ['I1', 'I2'])
-
- def testDeleteInterface(self):
- db = database.Database(self._database_dir)
- db.Load()
- db.DeleteInterface('I1')
- db.Save()
- self.assertFalse(
- os.path.exists(os.path.join(self._database_dir, 'I1.idl')))
- self.assertEquals(self._ListInterfaces(db), [])
-
- def testGetInterface(self):
- db = database.Database(self._database_dir)
- db.Load()
- interface = db.GetInterface('I1')
- self.assertEquals(interface.id, 'I1')
-
-
-if __name__ == '__main__':
- logging.config.fileConfig('logging.conf')
- if __name__ == '__main__':
- unittest.main()
« no previous file with comments | « client/dom/scripts/database.py ('k') | client/dom/scripts/databasebuilder.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698