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

Unified Diff: pkg/analysis_server/test/domain_analysis_test.dart

Issue 449213002: Rework "analysis.updateContent" analysis server request. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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: pkg/analysis_server/test/domain_analysis_test.dart
diff --git a/pkg/analysis_server/test/domain_analysis_test.dart b/pkg/analysis_server/test/domain_analysis_test.dart
index 78676ada9ebd81a0234584a76922a4942f99c914..0da56db2011d2322c673b5610cf0f40a0b3e559d 100644
--- a/pkg/analysis_server/test/domain_analysis_test.dart
+++ b/pkg/analysis_server/test/domain_analysis_test.dart
@@ -148,6 +148,21 @@ main() {
testUpdateContent() {
+ test('bad type', () {
+ AnalysisTestHelper helper = new AnalysisTestHelper();
+ helper.createSingleFileProject('// empty');
+ return helper.waitForOperationsFinished().then((_) {
+ Request request = new Request('0', ANALYSIS_UPDATE_CONTENT);
+ request.setParameter('files', {
+ helper.testFile: {
+ TYPE: 'foo',
+ }
+ });
+ Response response = helper.handler.handleRequest(request);
+ expect(response, isResponseFailure('0'));
+ });
+ });
+
test('full content', () {
AnalysisTestHelper helper = new AnalysisTestHelper();
helper.createSingleFileProject('// empty');
@@ -157,6 +172,7 @@ testUpdateContent() {
expect(errors, isEmpty);
// update code
helper.sendContentChange({
+ TYPE: ADD,
CONTENT: 'library lib'
});
// wait, there is an error
@@ -169,17 +185,23 @@ testUpdateContent() {
test('incremental', () {
AnalysisTestHelper helper = new AnalysisTestHelper();
- helper.createSingleFileProject('library A;');
+ String initialContent = 'library A;';
+ helper.createSingleFileProject(initialContent);
return helper.waitForOperationsFinished().then((_) {
// no errors initially
List<AnalysisError> errors = helper.getTestErrors();
expect(errors, isEmpty);
+ // Add the file to the cache
+ helper.sendContentChange({
+ TYPE: ADD,
+ CONTENT: initialContent
+ });
// update code
helper.sendContentChange({
- CONTENT: 'library lib',
+ TYPE: CHANGE,
+ REPLACEMENT: 'lib',
OFFSET: 'library '.length,
OLD_LENGTH: 'A;'.length,
- NEW_LENGTH: 'lib'.length,
});
// wait, there is an error
return helper.waitForOperationsFinished().then((_) {
@@ -212,6 +234,7 @@ testUpdateContent() {
return helper.waitForOperationsFinished().then((_) {
// update code
helper.sendContentChange({
+ TYPE: ADD,
CONTENT: 'library B;'
});
// There should be no errors
@@ -225,7 +248,7 @@ testUpdateContent() {
// Send a content change with a null content param--file should be
// reread from disk.
helper.sendContentChange({
- CONTENT: null
+ TYPE: REMOVE
});
// There should be errors now.
return helper.waitForOperationsFinished().then((_) {

Powered by Google App Engine
This is Rietveld 408576698