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

Side by Side Diff: dart/tests/try/web/incremental_compilation_update_test.dart

Issue 815123002: Incremental compilation of libraries with multiple parts. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments. Created 6 years 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 | Annotate | Revision Log
« no previous file with comments | « dart/pkg/dart2js_incremental/lib/library_updater.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 library trydart.incremental_compilation_update_test; 5 library trydart.incremental_compilation_update_test;
6 6
7 import 'dart:html' hide 7 import 'dart:html' hide
8 Element; 8 Element;
9 9
10 import 'dart:async' show 10 import 'dart:async' show
(...skipping 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after
1652 const ProgramExpectation( 1652 const ProgramExpectation(
1653 const <String>['A(v2)', 'B(v2)', 'B(A(v2))', 'A(B(v2))']), 1653 const <String>['A(v2)', 'B(v2)', 'B(A(v2))', 'A(B(v2))']),
1654 ]), 1654 ]),
1655 1655
1656 const EncodedResult( 1656 const EncodedResult(
1657 r""" 1657 r"""
1658 ==> main.dart <== 1658 ==> main.dart <==
1659 library test.main; 1659 library test.main;
1660 1660
1661 part 'part.dart'; 1661 part 'part.dart';
1662
1663
1662 ==> part.dart.patch <== 1664 ==> part.dart.patch <==
1663 part of test.main; 1665 part of test.main;
1664 1666
1665 main() { 1667 main() {
1666 <<<<<<< 1668 <<<<<<<
1667 print('Hello, World!'); 1669 print('Hello, World!');
1668 ======= 1670 =======
1669 print('Hello, Brave New World!'); 1671 print('Hello, Brave New World!');
1670 >>>>>>> 1672 >>>>>>>
1671 } 1673 }
1672 """, 1674 """,
1673 const [ 1675 const [
1674 'Hello, World!', 1676 'Hello, World!',
1675 const ProgramExpectation( 1677 'Hello, Brave New World!',
1676 const <String>['Hello, Brave New World!'],
1677 // TODO(ahe): Shouldn't throw.
1678 compileUpdatesShouldThrow: true),
1679 ]), 1678 ]),
1680 ]; 1679 ];
1681 1680
1682 void main() { 1681 void main() {
1683 listener.start(); 1682 listener.start();
1684 1683
1685 document.head.append(lineNumberStyle()); 1684 document.head.append(lineNumberStyle());
1686 1685
1687 summary = new SpanElement(); 1686 summary = new SpanElement();
1688 document.body.append(new HeadingElement.h1() 1687 document.body.append(new HeadingElement.h1()
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 ? { 'main.dart': program.code } 1761 ? { 'main.dart': program.code }
1763 : program.code; 1762 : program.code;
1764 Map<Uri, Uri> uriMap = <Uri, Uri>{}; 1763 Map<Uri, Uri> uriMap = <Uri, Uri>{};
1765 for (String name in code.keys) { 1764 for (String name in code.keys) {
1766 Uri uri = base.resolve('$name?v${version++}'); 1765 Uri uri = base.resolve('$name?v${version++}');
1767 inputProvider.cachedSources[uri] = new Future.value(code[name]); 1766 inputProvider.cachedSources[uri] = new Future.value(code[name]);
1768 uriMap[base.resolve(name)] = uri; 1767 uriMap[base.resolve(name)] = uri;
1769 } 1768 }
1770 Future future = test.incrementalCompiler.compileUpdates( 1769 Future future = test.incrementalCompiler.compileUpdates(
1771 uriMap, logVerbose: logger, logTime: logger); 1770 uriMap, logVerbose: logger, logTime: logger);
1771 bool compileUpdatesThrew = false;
1772 future = future.catchError((error, trace) { 1772 future = future.catchError((error, trace) {
1773 String statusMessage; 1773 String statusMessage;
1774 Future result; 1774 Future result;
1775 compileUpdatesThrew = true;
1775 if (program.compileUpdatesShouldThrow && 1776 if (program.compileUpdatesShouldThrow &&
1776 error is IncrementalCompilationFailed) { 1777 error is IncrementalCompilationFailed) {
1777 statusMessage = "Expected error in compileUpdates."; 1778 statusMessage = "Expected error in compileUpdates.";
1778 result = null; 1779 result = null;
1779 } else { 1780 } else {
1780 statusMessage = "Unexpected error in compileUpdates."; 1781 statusMessage = "Unexpected error in compileUpdates.";
1781 result = new Future.error(error, trace); 1782 result = new Future.error(error, trace);
1782 } 1783 }
1783 status.append(new HeadingElement.h3()..appendText(statusMessage)); 1784 status.append(new HeadingElement.h3()..appendText(statusMessage));
1784 return result; 1785 return result;
1785 }); 1786 });
1786 return future.then((String update) { 1787 return future.then((String update) {
1787 if (program.compileUpdatesShouldThrow) { 1788 if (program.compileUpdatesShouldThrow) {
1788 Expect.isNull(update); 1789 Expect.isTrue(
1790 compileUpdatesThrew,
1791 "Expected an exception in compileUpdates");
1792 Expect.isNull( update, "Expected update == null");
1789 return null; 1793 return null;
1790 } 1794 }
1791 print({'update': update}); 1795 print({'update': update});
1792 iframe.contentWindow.postMessage(['apply-update', update], '*'); 1796 iframe.contentWindow.postMessage(['apply-update', update], '*');
1793 1797
1794 return listener.expect( 1798 return listener.expect(
1795 program.messagesWith('iframe-dart-updated-main-done')) 1799 program.messagesWith('iframe-dart-updated-main-done'))
1796 .then((_) { 1800 .then((_) {
1801 // TODO(ahe): Enable SerializeScopeTestCase for multiple
1802 // parts.
1803 if (program.code is! String) return null;
1797 return new SerializeScopeTestCase( 1804 return new SerializeScopeTestCase(
1798 program.code, test.incrementalCompiler.mainApp, 1805 program.code, test.incrementalCompiler.mainApp,
1799 test.incrementalCompiler.compiler).run(); 1806 test.incrementalCompiler.compiler).run();
1800 }); 1807 });
1801 }); 1808 });
1802 }); 1809 });
1803 }); 1810 });
1804 }); 1811 });
1805 }).then((_) { 1812 }).then((_) {
1806 status.style.color = 'limegreen'; 1813 status.style.color = 'limegreen';
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1908 position: absolute; 1915 position: absolute;
1909 left: 0px; 1916 left: 0px;
1910 width: 3em; 1917 width: 3em;
1911 text-align: right; 1918 text-align: right;
1912 background-color: lightgoldenrodyellow; 1919 background-color: lightgoldenrodyellow;
1913 } 1920 }
1914 '''); 1921 ''');
1915 style.type = 'text/css'; 1922 style.type = 'text/css';
1916 return style; 1923 return style;
1917 } 1924 }
OLDNEW
« no previous file with comments | « dart/pkg/dart2js_incremental/lib/library_updater.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698