| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.engine_test; | 8 library engine.engine_test; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 6948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6959 } | 6959 } |
| 6960 void test_creation() { | 6960 void test_creation() { |
| 6961 JUnitTestCase.assertNotNull(new UniversalCachePartition(null, 8, null)); | 6961 JUnitTestCase.assertNotNull(new UniversalCachePartition(null, 8, null)); |
| 6962 } | 6962 } |
| 6963 void test_entrySet() { | 6963 void test_entrySet() { |
| 6964 UniversalCachePartition partition = | 6964 UniversalCachePartition partition = |
| 6965 new UniversalCachePartition(null, 8, null); | 6965 new UniversalCachePartition(null, 8, null); |
| 6966 TestSource source = new TestSource(); | 6966 TestSource source = new TestSource(); |
| 6967 DartEntry entry = new DartEntry(); | 6967 DartEntry entry = new DartEntry(); |
| 6968 partition.put(source, entry); | 6968 partition.put(source, entry); |
| 6969 JavaIterator<MapEntry<Source, SourceEntry>> entries = | 6969 Map<Source, SourceEntry> entryMap = partition.map; |
| 6970 new JavaIterator(getMapEntrySet(partition.map)); | 6970 JUnitTestCase.assertEquals(1, entryMap.length); |
| 6971 JUnitTestCase.assertTrue(entries.hasNext); | 6971 Source entryKey = entryMap.keys.first; |
| 6972 MapEntry<Source, SourceEntry> mapEntry = entries.next(); | 6972 JUnitTestCase.assertSame(source, entryKey); |
| 6973 JUnitTestCase.assertSame(source, mapEntry.getKey()); | 6973 JUnitTestCase.assertSame(entry, entryMap[entryKey]); |
| 6974 JUnitTestCase.assertSame(entry, mapEntry.getValue()); | |
| 6975 JUnitTestCase.assertFalse(entries.hasNext); | |
| 6976 } | 6974 } |
| 6977 void test_get() { | 6975 void test_get() { |
| 6978 UniversalCachePartition partition = | 6976 UniversalCachePartition partition = |
| 6979 new UniversalCachePartition(null, 8, null); | 6977 new UniversalCachePartition(null, 8, null); |
| 6980 TestSource source = new TestSource(); | 6978 TestSource source = new TestSource(); |
| 6981 JUnitTestCase.assertNull(partition.get(source)); | 6979 JUnitTestCase.assertNull(partition.get(source)); |
| 6982 } | 6980 } |
| 6983 void test_put_noFlush() { | 6981 void test_put_noFlush() { |
| 6984 UniversalCachePartition partition = | 6982 UniversalCachePartition partition = |
| 6985 new UniversalCachePartition(null, 8, null); | 6983 new UniversalCachePartition(null, 8, null); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7023 for (int i = 0; i < size; i++) { | 7021 for (int i = 0; i < size; i++) { |
| 7024 Source source = new TestSource("/test${i}.dart"); | 7022 Source source = new TestSource("/test${i}.dart"); |
| 7025 partition.put(source, new DartEntry()); | 7023 partition.put(source, new DartEntry()); |
| 7026 partition.accessedAst(source); | 7024 partition.accessedAst(source); |
| 7027 } | 7025 } |
| 7028 JUnitTestCase.assertEquals(size, partition.size()); | 7026 JUnitTestCase.assertEquals(size, partition.size()); |
| 7029 } | 7027 } |
| 7030 void _assertNonFlushedCount(int expectedCount, | 7028 void _assertNonFlushedCount(int expectedCount, |
| 7031 UniversalCachePartition partition) { | 7029 UniversalCachePartition partition) { |
| 7032 int nonFlushedCount = 0; | 7030 int nonFlushedCount = 0; |
| 7033 JavaIterator<MapEntry<Source, SourceEntry>> entries = | 7031 Map<Source, SourceEntry> entryMap = partition.map; |
| 7034 new JavaIterator(getMapEntrySet(partition.map)); | 7032 entryMap.values.forEach((SourceEntry value) { |
| 7035 while (entries.hasNext) { | 7033 if (value.getState(DartEntry.PARSED_UNIT) != CacheState.FLUSHED) { |
| 7036 MapEntry<Source, SourceEntry> entry = entries.next(); | |
| 7037 if (entry.getValue().getState(DartEntry.PARSED_UNIT) != | |
| 7038 CacheState.FLUSHED) { | |
| 7039 nonFlushedCount++; | 7034 nonFlushedCount++; |
| 7040 } | 7035 } |
| 7041 } | 7036 }); |
| 7042 JUnitTestCase.assertEquals(expectedCount, nonFlushedCount); | 7037 JUnitTestCase.assertEquals(expectedCount, nonFlushedCount); |
| 7043 } | 7038 } |
| 7044 } | 7039 } |
| 7045 | 7040 |
| 7046 | 7041 |
| 7047 class WorkManagerTest extends EngineTestCase { | 7042 class WorkManagerTest extends EngineTestCase { |
| 7048 void test_addFirst() { | 7043 void test_addFirst() { |
| 7049 TestSource source1 = new TestSource("/f1.dart"); | 7044 TestSource source1 = new TestSource("/f1.dart"); |
| 7050 TestSource source2 = new TestSource("/f2.dart"); | 7045 TestSource source2 = new TestSource("/f2.dart"); |
| 7051 WorkManager manager = new WorkManager(); | 7046 WorkManager manager = new WorkManager(); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7132 } | 7127 } |
| 7133 } | 7128 } |
| 7134 | 7129 |
| 7135 | 7130 |
| 7136 class _UniversalCachePartitionTest_test_setMaxCacheSize implements | 7131 class _UniversalCachePartitionTest_test_setMaxCacheSize implements |
| 7137 CacheRetentionPolicy { | 7132 CacheRetentionPolicy { |
| 7138 @override | 7133 @override |
| 7139 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => | 7134 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => |
| 7140 RetentionPriority.LOW; | 7135 RetentionPriority.LOW; |
| 7141 } | 7136 } |
| OLD | NEW |