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

Unified Diff: third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom_tests/generate/pack_unittest.py

Issue 877993004: Revert "Update mojo sdk to rev 8d45c89c30b230843c5bd6dd0693a555750946c0" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
Index: third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom_tests/generate/pack_unittest.py
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom_tests/generate/pack_unittest.py b/third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom_tests/generate/pack_unittest.py
deleted file mode 100644
index 329e242a7e9aa3cab612096772d7cba2ee6640ad..0000000000000000000000000000000000000000
--- a/third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom_tests/generate/pack_unittest.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# Copyright 2015 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 imp
-import os.path
-import sys
-import unittest
-
-
-def _GetDirAbove(dirname):
- """Returns the directory "above" this file containing |dirname| (which must
- also be "above" this file)."""
- path = os.path.abspath(__file__)
- while True:
- path, tail = os.path.split(path)
- assert tail
- if tail == dirname:
- return path
-
-
-try:
- imp.find_module("mojom")
-except ImportError:
- sys.path.append(os.path.join(_GetDirAbove("pylib"), "pylib"))
-from mojom.generate import pack
-from mojom.generate import module as mojom
-
-
-# TODO(yzshen): Move tests in pack_tests.py here.
-class PackTest(unittest.TestCase):
-
- def testMinVersion(self):
- """Tests that |min_version| is properly set for packed fields."""
- struct = mojom.Struct('test')
- struct.AddField('field_2', mojom.BOOL, 2)
- struct.AddField('field_0', mojom.INT32, 0)
- struct.AddField('field_1', mojom.INT64, 1)
- ps = pack.PackedStruct(struct)
-
- self.assertEquals("field_0", ps.packed_fields[0].field.name)
- self.assertEquals("field_2", ps.packed_fields[1].field.name)
- self.assertEquals("field_1", ps.packed_fields[2].field.name)
-
- self.assertEquals(1, ps.packed_fields[0].min_version)
- self.assertEquals(3, ps.packed_fields[1].min_version)
- self.assertEquals(2, ps.packed_fields[2].min_version)
-
- struct.fields[0].attributes = {'MinVersion': 1}
- ps = pack.PackedStruct(struct)
-
- self.assertEquals(0, ps.packed_fields[0].min_version)
- self.assertEquals(1, ps.packed_fields[1].min_version)
- self.assertEquals(0, ps.packed_fields[2].min_version)

Powered by Google App Engine
This is Rietveld 408576698