Commit Graph

82 Commits

Author SHA1 Message Date
danrubel@google.com 6da2ff1d40 improve analysis server notifications
* add context id to error notifications
* add analysis.complete notification

BUG=
R=paulberry@google.com

Review URL: https://codereview.chromium.org//299513003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36363 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-20 16:42:50 +00:00
danrubel@google.com 8b119623e2 update analysis_server_test with expected error code message arguments
BUG=
R=paulberry@google.com

Review URL: https://codereview.chromium.org//291023002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36327 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-19 21:27:55 +00:00
danrubel@google.com f21f056bba implement ByteStreamClientChannel close
BUG=
R=paulberry@google.com

Review URL: https://codereview.chromium.org//284353002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36316 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-19 19:35:01 +00:00
danrubel@google.com 88344402e1 move context id constant to AnalysisServer
BUG=
R=brianwilkerson@google.com, paulberry@google.com

Review URL: https://codereview.chromium.org//284103005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36263 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-16 17:44:24 +00:00
paulberry@google.com 206854b25e Fix remaining RequestDatum tests.
There were a few problems:

- An expression like "x is List<Foo>" doesn't guarantee that every
  element of x is of type Foo.  We need to check item by item.
  Similar for maps.

- InvalidParameterResponseMatcher was failing to account for the fact
  that the response gets wrapped in a RequestFailure object.

- Tests weren't calling setUp().

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//289003003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36237 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-15 20:03:53 +00:00
danrubel@google.com 03aaf34742 add RequestDatum tests and fix some situations
BUG=
R=paulberry@google.com

Review URL: https://codereview.chromium.org//281373002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36217 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-15 11:55:26 +00:00
danrubel@google.com c263b483a7 allow client to specify any combination of add/modified/removed
BUG=
R=brianwilkerson@google.com, paulberry@google.com

Review URL: https://codereview.chromium.org//288013003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36216 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-15 11:49:21 +00:00
scheglov@google.com 8efee14586 Add a top-level typed_mock package.
R=brianwilkerson@google.com, danrubel@google.com
BUG=

Review URL: https://codereview.chromium.org//281943002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36170 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-14 15:36:18 +00:00
paulberry@google.com 839e807406 Leave "error" key out of response JSON when there is no error.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//282993002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36169 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-14 15:04:31 +00:00
paulberry@google.com 297068d235 Add explicit dependency from analysis_server to mock.
Previously we were relying on the implicit dependency via the unittest
package, but this dependency was dropped, causing analysis_server to
break.

Eventually we want to stop relying on the mock package, but we're not
ready for that yet.

R=danrubel@google.com

Review URL: https://codereview.chromium.org//277773003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36144 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-14 00:29:34 +00:00
danrubel@google.com a08555d604 new ByteStreamClientChannel
BUG=dartbug.com/18632
R=paulberry@google.com

Review URL: https://codereview.chromium.org//276113002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36059 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-12 20:17:57 +00:00
scheglov@google.com fa5f1af052 New analysis_server snapshot and completion.dart in analysis_services.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//263213007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35817 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-06 18:54:51 +00:00
scheglov@google.com 77fbba6bf0 Translate parts of engine.services project.
Some tweaks for Java implementations to get valid or better Dart code.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//250823006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35466 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-26 19:01:13 +00:00
scheglov@google.com 5e718a35d0 verifyNoMoreInteractions() and verifyZeroInteractions()
R=paulberry@google.com, brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//250813003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35441 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-25 19:18:28 +00:00
paulberry@google.com ceb5f9858e Upgrade analysis server to use analyzer-0.14.2
This picks up the fix for dartbug.com/18379, so source strings are
correctly encoded now.

R=scheglov@google.com

Review URL: https://codereview.chromium.org//250963002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35432 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-25 16:58:42 +00:00
scheglov@google.com d0763d1997 verify() for mocks
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org//257783005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35428 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-25 16:14:18 +00:00
scheglov@google.com c846bdd7c6 Restore thenReturnList().
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org//251733002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35423 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-25 14:05:25 +00:00
scheglov@google.com 7166546aaa Argument matchers for mocks.
R=paulberry@google.com, brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//255503005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35415 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-24 23:49:37 +00:00
scheglov@google.com 1544c07521 Typed mocks library.
R=danrubel@google.com, brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org//252463002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35399 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-24 20:22:42 +00:00
paulberry@google.com 1c873d4a38 Use @MirrorsUsed to prevent analysis server tests from slowing down in dart2js.
R=scheglov@google.com

Review URL: https://codereview.chromium.org//254533004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35396 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-24 20:11:26 +00:00
paulberry@google.com 9271ac7a8f Rework some analysis server tests using mocks.
R=scheglov@google.com

Review URL: https://codereview.chromium.org//252373003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35374 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-24 15:05:11 +00:00
paulberry@google.com 5d44255126 Trigger analysis when context.applyChanges request is received.
With this change, the analysis server is now capable of analyzing a
source file and responding with error notifications.

R=jwren@google.com

Review URL: https://codereview.chromium.org//246013007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35373 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-24 14:58:15 +00:00
paulberry@google.com 22ee284c47 Serialize AnalysisErrors to JSON in the analysis server.
R=scheglov@google.com

Review URL: https://codereview.chromium.org//247893004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35329 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-23 20:35:43 +00:00
paulberry@google.com 2424320373 Don't make assumptions about source encoding in analysis server tests (TBR).
On Windows, the encoding of an absolute path like "/foo.dart" contains
a drive letter (e.g. "102file:///e:/foo.dart"); on Mac and Linux it
doesn't.  Call ".encoding" from the test so that we don't depend on
the specific file name encoding in use.

As a side benefit, this makes the test independent of bug 18379.

Review URL: https://codereview.chromium.org//247143009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35327 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-23 20:02:18 +00:00
paulberry@google.com 19572ac352 Use AnalysisServer.running only to track whether server has been shut down.
Previously, AnalysisServer.run() and AnalysisServer.performTask() also
tried to use this variable to track whether there was a pending call
to performTask() on the event queue.  The resulting confusion
prevented analysis from ever running.

It turns out that we don't need to separately track whether there is a
pending call to performTask(), as long as we enforce the invariant
that there is a pending call to performTask() exactly when
contextWorkQueue is non-empty.

R=brianwilkerson@google.com, danrubel@google.com

Review URL: https://codereview.chromium.org//246603005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35323 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-23 18:35:58 +00:00
scheglov@google.com 89c918f8f4 New analysis services snapshot.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//247813002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35271 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-22 17:30:49 +00:00
paulberry@google.com 451b5519cb Consistently type check analysis server request parameters.
Introduces a class RequestDatum, which wraps request parameters (or
components thereof) and provides type checking and coercion.
RequestDatum also provides an operator[] so that nested parameters can
be type checked and coerced at every level of nesting.

Previously, our checking and coercion was ad-hoc, and as a result some
parameters weren't type checked at all.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//245113006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35228 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-21 22:21:39 +00:00
paulberry@google.com 0540e6a85b Eliminate nondeterminism from analysis server unit tests.
Previously, we tested for non-responsiveness in the analysis server
using timeout(new Duration(seconds: 1)).  This caused sporadic
failures on slower buildbots.  Now, we simply let the event loop run
20 times--this should produce consistent results regardless of machine
speed.

R=brianwilkerson@google.com, danrubel@google.com

Review URL: https://codereview.chromium.org//243703008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35221 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-21 19:48:15 +00:00
paulberry@google.com 8fd57e0efa Disable test "AnalysisServer createContext" again.
This is failing on some buildbots.  I will investigate next week.

Review URL: https://codereview.chromium.org//243763003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35188 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-18 22:58:48 +00:00
paulberry@google.com a1a3ae4eeb Fix a typo in the analysis server's status page
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//243383004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35186 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-18 22:26:49 +00:00
paulberry@google.com 783aca1892 Analysis server context ID is now specified by the client.
This allows the client to start sending commands that use the context
immediately, without having to wait for a response to find out the
context ID.

If the client tries to create two contexts with the same ID, that is
an error.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//243753002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35185 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-18 22:20:53 +00:00
paulberry@google.com f6ec765421 Fix and re-enable analysis server tests that were commented out.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//243653003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35183 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-18 20:50:23 +00:00
scheglov@google.com 0d16b4e5ca Translate server interfaces and navigation/outline computers.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//242373005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35182 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-18 20:16:01 +00:00
paulberry@google.com 6a50f6f490 Make the http portion of the analysis server optional.
If no "--port" option is supplied, the analysis server won't start up
an http server, and it will only communicate with the client over
stdio.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//239333006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35129 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-16 20:03:25 +00:00
paulberry@google.com f548643064 Exit stdio-based analysis server when stdin closed.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//235953019

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35116 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-16 17:34:35 +00:00
paulberry@google.com 93deb52cd6 Add a message for analysis server to indicate a successful connection.
This complements the "server already started" error introduced in
r35046.  It's now easy for the client to detect whether a connection
to the server was successful--it simply connects and waits for the
initial message from the server.  The message returned on a successful
connection is:

{"event":"server.connected"}

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//239213004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35108 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-16 15:11:35 +00:00
paulberry@google.com d136370b7c Remove "listening on port $port" message.
This prevents it from interfering with stdio-based communication
between the editor and analysis server.

R=brianwilkerson@google.com, jwren@google.com

Review URL: https://codereview.chromium.org//236063019

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35107 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-16 14:55:07 +00:00
paulberry@google.com d30a35bd5a Allow the analysis server to connect to the client over stdio.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//236133013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35095 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-15 22:52:56 +00:00
paulberry@google.com 7c3b05627d Remove redundant initialization of HttpAnalysisServer.socketServer.
This was mistakenly left out of r35075.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//237963009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35089 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-15 21:45:47 +00:00
paulberry@google.com 13f0c014d6 Create analysis server ByteStreamServerChannel class.
This class serves a parallel role to the existing
WebSocketServerChannel interface, except that it handles exchanging
data with stdio rather than with a WebSocket.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//238293006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35088 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-15 21:43:00 +00:00
paulberry@google.com 5a7486998f Split off a Driver class from analysis server's HttpAnalysisServer.
The Driver class sits above the HttpAnalysisServer, parsing command
line options and deciding how the sever should be run.  With this
change, HttpAnalysisServer now contains only http-specific code.

R=brianwilkerson@google.com, jwren@google.com

Review URL: https://codereview.chromium.org//239573002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35075 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-15 19:55:21 +00:00
scheglov@google.com 25f3afdb4d Use mirrors and annotations to find test methods.
It was too tiresome to type test method names three times, jumping back and forth
between test class and main earlier this morning. :-)

Also, we had a discussion about tests in the office.

R=brianwilkerson@google.com, danrubel@google.com, pquitslund@google.com
BUG=

Review URL: https://codereview.chromium.org//228013003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35067 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-15 16:34:17 +00:00
paulberry@google.com 33c7e78bb0 Split analysis server's HttpAnalysisServer into two classes.
Behaviours of the HttpAnalysisServer which are independent of the
WebSocket transport mechanism have been moved to a new class,
SocketServer, which will also be used when the transport mechanism is
stdio.

GetHander now holds a reference to the SocketServer rather than the
AnalysisServer, so that we don't need to go to extra effort to update
it when the AnalysisServer is created.

R=brianwilkerson@google.com, jwren@google.com

Review URL: https://codereview.chromium.org//237643003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35061 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-15 15:41:09 +00:00
paulberry@google.com ab56da71ce Fix race condition with "server already started" error.
We can't report the "server already started" error prior to the call
to WebSocketTransformer.upgrade(), because it's possible that a
different client will successfully establish a connection during the
upgrade process.  Instead, check after the call to upgrade().  This
means that if there is an error, we have to report it via a
RequestError object rather than using an HTTP error.

When we add stdio as a transport mechanism, this will have the further
advantage of allowing the "server already started" error to be
detected by code that is independent of the transport mechanism.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//237793002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35046 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-14 22:13:10 +00:00
scheglov@google.com b8ac1a83a0 Improve analysis_server/protocol.dart test coverage.
R=brianwilkerson@google.com, danrubel@google.com
BUG=

Review URL: https://codereview.chromium.org//227713004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34794 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-07 19:01:10 +00:00
brianwilkerson@google.com 7e7426ae99 Clean-up and progress on analysis server
R=danrubel@google.com

Review URL: https://codereview.chromium.org//214933002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34529 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-28 21:26:03 +00:00
danrubel@google.com b25bbbb5eb utility for manually running all analysis_server tests
BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//209003005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34522 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-28 20:29:30 +00:00
kevmoo@google.com 1119399bf3 pkg/analysis_server: fixes for unittest deprecations
R=danrubel@google.com

Review URL: https://codereview.chromium.org//217153002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34503 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-28 16:10:00 +00:00
lrn@google.com 6f76a96fcf Introduce class Sink<T>.
The sink only has "add" and "close" methods. It is the supertype of both EventSink and ChunkedConversionSink.

Made startChunkedConversion take Sink as argument, but still return ChunkedConversionSink. The more specialized chunked conversion sinks are test for, just as they always were.

R=ajohnsen@google.com

Review URL: https://codereview.chromium.org//203603008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34157 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-20 10:13:01 +00:00
danrubel@google.com faf2c8ddf4 (TBR) simplify check for valid SDK directory
BUG=

Review URL: https://codereview.chromium.org//198083004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33618 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-12 21:47:13 +00:00