| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | /****************************************************************************
 | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2016-01-15 14:55:33 +01:00
										 |  |  | ** Copyright (C) 2016 The Qt Company Ltd. | 
					
						
							|  |  |  | ** Contact: https://www.qt.io/licensing/
 | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | ** | 
					
						
							|  |  |  | ** This file is part of Qt Creator. | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** Commercial License Usage | 
					
						
							|  |  |  | ** Licensees holding valid commercial Qt licenses may use this file in | 
					
						
							|  |  |  | ** accordance with the commercial license agreement provided with the | 
					
						
							|  |  |  | ** Software or, alternatively, in accordance with the terms contained in | 
					
						
							| 
									
										
										
										
											2016-01-15 14:55:33 +01:00
										 |  |  | ** a written agreement between you and The Qt Company. For licensing terms | 
					
						
							|  |  |  | ** and conditions see https://www.qt.io/terms-conditions. For further
 | 
					
						
							|  |  |  | ** information use the contact form at https://www.qt.io/contact-us.
 | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2016-01-15 14:55:33 +01:00
										 |  |  | ** GNU General Public License Usage | 
					
						
							|  |  |  | ** Alternatively, this file may be used under the terms of the GNU | 
					
						
							|  |  |  | ** General Public License version 3 as published by the Free Software | 
					
						
							|  |  |  | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT | 
					
						
							|  |  |  | ** included in the packaging of this file. Please review the following | 
					
						
							|  |  |  | ** information to ensure the GNU General Public License requirements will | 
					
						
							|  |  |  | ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
 | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | ** | 
					
						
							|  |  |  | ****************************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-15 17:41:41 +02:00
										 |  |  | #include "googletest.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-29 16:49:56 +02:00
										 |  |  | #include "mockclangcodemodelclient.h"
 | 
					
						
							|  |  |  | #include "mockclangcodemodelserver.h"
 | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-29 16:49:56 +02:00
										 |  |  | #include <clangcodemodelclientproxy.h>
 | 
					
						
							|  |  |  | #include <clangcodemodelserverproxy.h>
 | 
					
						
							| 
									
										
										
										
											2015-08-19 12:36:43 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-15 16:43:37 +02:00
										 |  |  | #include <clangcodemodelservermessages.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-19 12:36:43 +02:00
										 |  |  | #include <readmessageblock.h>
 | 
					
						
							|  |  |  | #include <writemessageblock.h>
 | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-16 12:38:04 +02:00
										 |  |  | #include <QBuffer>
 | 
					
						
							|  |  |  | #include <QString>
 | 
					
						
							|  |  |  | #include <QVariant>
 | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-16 12:38:04 +02:00
										 |  |  | #include <vector>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-16 11:56:00 +02:00
										 |  |  | using namespace ClangBackEnd; | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | using ::testing::Args; | 
					
						
							|  |  |  | using ::testing::Property; | 
					
						
							|  |  |  | using ::testing::Eq; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class ClientServerInProcess : public ::testing::Test | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  |     ClientServerInProcess(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void SetUp(); | 
					
						
							|  |  |  |     void TearDown(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-19 12:36:43 +02:00
										 |  |  |     void scheduleServerMessages(); | 
					
						
							|  |  |  |     void scheduleClientMessages(); | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-31 16:10:36 +02:00
										 |  |  | protected: | 
					
						
							| 
									
										
										
										
											2015-12-02 13:31:07 +01:00
										 |  |  |     Utf8String filePath{Utf8StringLiteral(TESTDATA_DIR"/complete_extractor_function.cpp")}; | 
					
						
							|  |  |  |     ClangBackEnd::FileContainer fileContainer{filePath, | 
					
						
							| 
									
										
										
										
											2015-08-31 16:10:36 +02:00
										 |  |  |                                               Utf8StringLiteral("projectPartId"), | 
					
						
							|  |  |  |                                               Utf8StringLiteral("unsaved content"), | 
					
						
							|  |  |  |                                               true, | 
					
						
							|  |  |  |                                               1}; | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  |     QBuffer buffer; | 
					
						
							| 
									
										
										
										
											2016-06-29 16:49:56 +02:00
										 |  |  |     MockClangCodeModelClient mockClangCodeModelClient; | 
					
						
							|  |  |  |     MockClangCodeModelServer mockClangCodeModelServer; | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-29 16:49:56 +02:00
										 |  |  |     ClangBackEnd::ClangCodeModelServerProxy serverProxy; | 
					
						
							|  |  |  |     ClangBackEnd::ClangCodeModelClientProxy clientProxy; | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-19 12:36:43 +02:00
										 |  |  | TEST_F(ClientServerInProcess, SendEndMessage) | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-06-29 16:49:56 +02:00
										 |  |  |     EXPECT_CALL(mockClangCodeModelServer, end()) | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  |         .Times(1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     serverProxy.end(); | 
					
						
							| 
									
										
										
										
											2015-08-19 12:36:43 +02:00
										 |  |  |     scheduleServerMessages(); | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-19 12:36:43 +02:00
										 |  |  | TEST_F(ClientServerInProcess, SendAliveMessage) | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-06-29 16:49:56 +02:00
										 |  |  |     EXPECT_CALL(mockClangCodeModelClient, alive()) | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  |         .Times(1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     clientProxy.alive(); | 
					
						
							| 
									
										
										
										
											2015-08-19 12:36:43 +02:00
										 |  |  |     scheduleClientMessages(); | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-31 14:36:58 +02:00
										 |  |  | TEST_F(ClientServerInProcess, SendRegisterTranslationUnitForEditorMessage) | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2015-12-02 13:31:07 +01:00
										 |  |  |     ClangBackEnd::RegisterTranslationUnitForEditorMessage message({fileContainer}, | 
					
						
							|  |  |  |                                                                   filePath, | 
					
						
							|  |  |  |                                                                   {filePath}); | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-29 16:49:56 +02:00
										 |  |  |     EXPECT_CALL(mockClangCodeModelServer, registerTranslationUnitsForEditor(message)) | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  |         .Times(1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-31 14:36:58 +02:00
										 |  |  |     serverProxy.registerTranslationUnitsForEditor(message); | 
					
						
							| 
									
										
										
										
											2015-08-19 12:36:43 +02:00
										 |  |  |     scheduleServerMessages(); | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-13 15:56:41 +02:00
										 |  |  | TEST_F(ClientServerInProcess, SendUpdateTranslationUnitsForEditorMessage) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     ClangBackEnd::UpdateTranslationUnitsForEditorMessage message({fileContainer}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-29 16:49:56 +02:00
										 |  |  |     EXPECT_CALL(mockClangCodeModelServer, updateTranslationUnitsForEditor(message)) | 
					
						
							| 
									
										
										
										
											2015-10-13 15:56:41 +02:00
										 |  |  |         .Times(1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     serverProxy.updateTranslationUnitsForEditor(message); | 
					
						
							|  |  |  |     scheduleServerMessages(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-31 14:36:58 +02:00
										 |  |  | TEST_F(ClientServerInProcess, SendUnregisterTranslationUnitsForEditorMessage) | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2015-08-31 14:36:58 +02:00
										 |  |  |     ClangBackEnd::UnregisterTranslationUnitsForEditorMessage message({fileContainer}); | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-29 16:49:56 +02:00
										 |  |  |     EXPECT_CALL(mockClangCodeModelServer, unregisterTranslationUnitsForEditor(message)) | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  |         .Times(1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-31 14:36:58 +02:00
										 |  |  |     serverProxy.unregisterTranslationUnitsForEditor(message); | 
					
						
							| 
									
										
										
										
											2015-08-19 12:36:43 +02:00
										 |  |  |     scheduleServerMessages(); | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-31 16:10:36 +02:00
										 |  |  | TEST_F(ClientServerInProcess, SendRegisterUnsavedFilesForEditorMessage) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     ClangBackEnd::RegisterUnsavedFilesForEditorMessage message({fileContainer}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-29 16:49:56 +02:00
										 |  |  |     EXPECT_CALL(mockClangCodeModelServer, registerUnsavedFilesForEditor(message)) | 
					
						
							| 
									
										
										
										
											2015-08-31 16:10:36 +02:00
										 |  |  |         .Times(1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     serverProxy.registerUnsavedFilesForEditor(message); | 
					
						
							|  |  |  |     scheduleServerMessages(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TEST_F(ClientServerInProcess, SendUnregisterUnsavedFilesForEditorMessage) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     ClangBackEnd::UnregisterUnsavedFilesForEditorMessage message({fileContainer}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-29 16:49:56 +02:00
										 |  |  |     EXPECT_CALL(mockClangCodeModelServer, unregisterUnsavedFilesForEditor(message)) | 
					
						
							| 
									
										
										
										
											2015-08-31 16:10:36 +02:00
										 |  |  |         .Times(1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     serverProxy.unregisterUnsavedFilesForEditor(message); | 
					
						
							|  |  |  |     scheduleServerMessages(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-19 12:36:43 +02:00
										 |  |  | TEST_F(ClientServerInProcess, SendCompleteCodeMessage) | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2015-08-19 12:36:43 +02:00
										 |  |  |     ClangBackEnd::CompleteCodeMessage message(Utf8StringLiteral("foo.cpp"), 24, 33, Utf8StringLiteral("do what I want")); | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-29 16:49:56 +02:00
										 |  |  |     EXPECT_CALL(mockClangCodeModelServer, completeCode(message)) | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  |         .Times(1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-19 12:36:43 +02:00
										 |  |  |     serverProxy.completeCode(message); | 
					
						
							|  |  |  |     scheduleServerMessages(); | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-09 12:55:42 +02:00
										 |  |  | TEST_F(ClientServerInProcess, SendRequestDocumentAnnotationsMessage) | 
					
						
							| 
									
										
										
										
											2015-08-31 16:28:26 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-06-09 12:55:42 +02:00
										 |  |  |     ClangBackEnd::RequestDocumentAnnotationsMessage message({Utf8StringLiteral("foo.cpp"), | 
					
						
							|  |  |  |                                                              Utf8StringLiteral("projectId")}); | 
					
						
							| 
									
										
										
										
											2015-08-31 16:28:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-09 12:55:42 +02:00
										 |  |  |     EXPECT_CALL(mockClangCodeModelServer, requestDocumentAnnotations(message)) | 
					
						
							| 
									
										
										
										
											2015-08-31 16:28:26 +02:00
										 |  |  |         .Times(1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-09 12:55:42 +02:00
										 |  |  |     serverProxy.requestDocumentAnnotations(message); | 
					
						
							| 
									
										
										
										
											2015-11-18 17:07:44 +01:00
										 |  |  |     scheduleServerMessages(); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2015-08-31 16:28:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-19 12:36:43 +02:00
										 |  |  | TEST_F(ClientServerInProcess, SendCodeCompletedMessage) | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2015-07-22 17:33:27 +02:00
										 |  |  |     ClangBackEnd::CodeCompletions codeCompletions({Utf8StringLiteral("newFunction()")}); | 
					
						
							| 
									
										
										
										
											2016-01-11 15:20:04 +01:00
										 |  |  |     ClangBackEnd::CodeCompletedMessage message(codeCompletions, | 
					
						
							|  |  |  |                                                ClangBackEnd::CompletionCorrection::NoCorrection, | 
					
						
							|  |  |  |                                                1); | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-29 16:49:56 +02:00
										 |  |  |     EXPECT_CALL(mockClangCodeModelClient, codeCompleted(message)) | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  |         .Times(1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-19 12:36:43 +02:00
										 |  |  |     clientProxy.codeCompleted(message); | 
					
						
							|  |  |  |     scheduleClientMessages(); | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-31 14:36:58 +02:00
										 |  |  | TEST_F(ClientServerInProcess, SendRegisterProjectPartsForEditorMessage) | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2015-06-16 11:56:00 +02:00
										 |  |  |     ClangBackEnd::ProjectPartContainer projectContainer(Utf8StringLiteral(TESTDATA_DIR"/complete.pro")); | 
					
						
							| 
									
										
										
										
											2015-08-31 14:36:58 +02:00
										 |  |  |     ClangBackEnd::RegisterProjectPartsForEditorMessage message({projectContainer}); | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-29 16:49:56 +02:00
										 |  |  |     EXPECT_CALL(mockClangCodeModelServer, registerProjectPartsForEditor(message)) | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  |         .Times(1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-31 14:36:58 +02:00
										 |  |  |     serverProxy.registerProjectPartsForEditor(message); | 
					
						
							| 
									
										
										
										
											2015-08-19 12:36:43 +02:00
										 |  |  |     scheduleServerMessages(); | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-31 14:36:58 +02:00
										 |  |  | TEST_F(ClientServerInProcess, SendUnregisterProjectPartsForEditorMessage) | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2015-08-31 14:36:58 +02:00
										 |  |  |     ClangBackEnd::UnregisterProjectPartsForEditorMessage message({Utf8StringLiteral(TESTDATA_DIR"/complete.pro")}); | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-29 16:49:56 +02:00
										 |  |  |     EXPECT_CALL(mockClangCodeModelServer, unregisterProjectPartsForEditor(message)) | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  |         .Times(1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-31 14:36:58 +02:00
										 |  |  |     serverProxy.unregisterProjectPartsForEditor(message); | 
					
						
							| 
									
										
										
										
											2015-08-19 12:36:43 +02:00
										 |  |  |     scheduleServerMessages(); | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-25 15:29:28 +01:00
										 |  |  | TEST_F(ClientServerInProcess, UpdateVisibleTranslationUnitsMessage) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     ClangBackEnd::UpdateVisibleTranslationUnitsMessage message(Utf8StringLiteral(TESTDATA_DIR"/fileone.cpp"), | 
					
						
							|  |  |  |                                                                {Utf8StringLiteral(TESTDATA_DIR"/fileone.cpp"), | 
					
						
							|  |  |  |                                                                 Utf8StringLiteral(TESTDATA_DIR"/filetwo.cpp")}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-29 16:49:56 +02:00
										 |  |  |     EXPECT_CALL(mockClangCodeModelServer, updateVisibleTranslationUnits(message)) | 
					
						
							| 
									
										
										
										
											2015-11-25 15:29:28 +01:00
										 |  |  |         .Times(1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     serverProxy.updateVisibleTranslationUnits(message); | 
					
						
							|  |  |  |     scheduleServerMessages(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-09 12:55:42 +02:00
										 |  |  | TEST_F(ClientServerInProcess, SendDocumentAnnotationsChangedMessage) | 
					
						
							| 
									
										
										
										
											2015-08-31 16:28:26 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-23 12:28:30 +01:00
										 |  |  |     ClangBackEnd::HighlightingTypes types; | 
					
						
							|  |  |  |     types.mainHighlightingType = ClangBackEnd::HighlightingType::Keyword; | 
					
						
							|  |  |  |     ClangBackEnd::TokenInfoContainer tokenInfo(1, 1, 1, types); | 
					
						
							| 
									
										
										
										
											2016-06-09 12:55:42 +02:00
										 |  |  |     ClangBackEnd::DiagnosticContainer diagnostic(Utf8StringLiteral("don't do that"), | 
					
						
							| 
									
										
										
										
											2015-08-31 16:28:26 +02:00
										 |  |  |                                                 Utf8StringLiteral("warning"), | 
					
						
							|  |  |  |                                                 {Utf8StringLiteral("-Wpadded"), Utf8StringLiteral("-Wno-padded")}, | 
					
						
							|  |  |  |                                                 ClangBackEnd::DiagnosticSeverity::Warning, | 
					
						
							|  |  |  |                                                 {Utf8StringLiteral("foo.cpp"), 20u, 103u}, | 
					
						
							|  |  |  |                                                 {{{Utf8StringLiteral("foo.cpp"), 20u, 103u}, {Utf8StringLiteral("foo.cpp"), 20u, 110u}}}, | 
					
						
							|  |  |  |                                                 {}, | 
					
						
							|  |  |  |                                                 {}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-09 12:55:42 +02:00
										 |  |  |     ClangBackEnd::DocumentAnnotationsChangedMessage message(fileContainer, | 
					
						
							|  |  |  |                                                             {diagnostic}, | 
					
						
							| 
									
										
										
										
											2016-10-04 16:23:42 +02:00
										 |  |  |                                                             {}, | 
					
						
							| 
									
										
										
										
											2017-12-05 09:42:35 +01:00
										 |  |  |                                                             {tokenInfo}, | 
					
						
							| 
									
										
										
										
											2016-06-09 12:55:42 +02:00
										 |  |  |                                                             QVector<SourceRangeContainer>()); | 
					
						
							| 
									
										
										
										
											2015-08-31 16:28:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-18 17:07:44 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-09 12:55:42 +02:00
										 |  |  |     EXPECT_CALL(mockClangCodeModelClient, documentAnnotationsChanged(message)) | 
					
						
							| 
									
										
										
										
											2015-11-18 17:07:44 +01:00
										 |  |  |         .Times(1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-09 12:55:42 +02:00
										 |  |  |     clientProxy.documentAnnotationsChanged(message); | 
					
						
							| 
									
										
										
										
											2015-11-18 17:07:44 +01:00
										 |  |  |     scheduleClientMessages(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | ClientServerInProcess::ClientServerInProcess() | 
					
						
							| 
									
										
										
										
											2016-06-29 16:49:56 +02:00
										 |  |  |     : serverProxy(&mockClangCodeModelClient, &buffer), | 
					
						
							|  |  |  |       clientProxy(&mockClangCodeModelServer, &buffer) | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void ClientServerInProcess::SetUp() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     buffer.open(QIODevice::ReadWrite); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void ClientServerInProcess::TearDown() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     buffer.close(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-19 12:36:43 +02:00
										 |  |  | void ClientServerInProcess::scheduleServerMessages() | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     buffer.seek(0); | 
					
						
							| 
									
										
										
										
											2015-08-19 12:36:43 +02:00
										 |  |  |     clientProxy.readMessages(); | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  |     buffer.buffer().clear(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-19 12:36:43 +02:00
										 |  |  | void ClientServerInProcess::scheduleClientMessages() | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     buffer.seek(0); | 
					
						
							| 
									
										
										
										
											2015-08-19 12:36:43 +02:00
										 |  |  |     serverProxy.readMessages(); | 
					
						
							| 
									
										
										
										
											2015-06-01 18:51:55 +02:00
										 |  |  |     buffer.buffer().clear(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |