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

Side by Side Diff: services/prediction/prediction_apptests.cc

Issue 1915403002: ApplicationImpl::ConnectToServiceDeprecated() -> mojo::ConnectToService() conversion, part 2. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: doh Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // To test, run "out/Debug//mojo_shell mojo:prediction_apptests" 5 // To test, run "out/Debug//mojo_shell mojo:prediction_apptests"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "mojo/public/cpp/application/application_impl.h" 9 #include "mojo/public/cpp/application/application_impl.h"
10 #include "mojo/public/cpp/application/application_test_base.h" 10 #include "mojo/public/cpp/application/application_test_base.h"
11 #include "mojo/public/cpp/application/connect.h"
11 #include "mojo/services/prediction/interfaces/prediction.mojom.h" 12 #include "mojo/services/prediction/interfaces/prediction.mojom.h"
12 13
13 namespace prediction { 14 namespace prediction {
14 15
15 void GetPredictionListAndEnd(std::vector<std::string>* output_list, 16 void GetPredictionListAndEnd(std::vector<std::string>* output_list,
16 const mojo::Array<mojo::String>& input_list) { 17 const mojo::Array<mojo::String>& input_list) {
17 *output_list = input_list.To<std::vector<std::string>>(); 18 *output_list = input_list.To<std::vector<std::string>>();
18 base::MessageLoop::current()->Quit(); 19 base::MessageLoop::current()->Quit();
19 } 20 }
20 21
21 class PredictionApptest : public mojo::test::ApplicationTestBase { 22 class PredictionApptest : public mojo::test::ApplicationTestBase {
22 public: 23 public:
23 PredictionApptest() : ApplicationTestBase() {} 24 PredictionApptest() : ApplicationTestBase() {}
24 25
25 ~PredictionApptest() override {} 26 ~PredictionApptest() override {}
26 27
27 void SetUp() override { 28 void SetUp() override {
28 mojo::test::ApplicationTestBase::SetUp(); 29 mojo::test::ApplicationTestBase::SetUp();
29 application_impl()->ConnectToServiceDeprecated("mojo:prediction_service", 30 mojo::ConnectToService(application_impl()->shell(),
30 &prediction_); 31 "mojo:prediction_service", GetProxy(&prediction_));
31 } 32 }
32 33
33 std::vector<std::string> GetPredictionListClient( 34 std::vector<std::string> GetPredictionListClient(
34 mojo::Array<PrevWordInfoPtr>& prev_words, 35 mojo::Array<PrevWordInfoPtr>& prev_words,
35 const mojo::String& cur_word) { 36 const mojo::String& cur_word) {
36 PredictionInfoPtr prediction_info = PredictionInfo::New(); 37 PredictionInfoPtr prediction_info = PredictionInfo::New();
37 prediction_info->previous_words = prev_words.Pass(); 38 prediction_info->previous_words = prev_words.Pass();
38 prediction_info->current_word = cur_word; 39 prediction_info->current_word = cur_word;
39 40
40 std::vector<std::string> prediction_list; 41 std::vector<std::string> prediction_list;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 PrevWordInfoPtr prev_word = PrevWordInfo::New(); 118 PrevWordInfoPtr prev_word = PrevWordInfo::New();
118 prev_word->word = "This"; 119 prev_word->word = "This";
119 prev_word->is_beginning_of_sentence = true; 120 prev_word->is_beginning_of_sentence = true;
120 mojo::Array<PrevWordInfoPtr> prev_words = 121 mojo::Array<PrevWordInfoPtr> prev_words =
121 mojo::Array<PrevWordInfoPtr>::New(0); 122 mojo::Array<PrevWordInfoPtr>::New(0);
122 prev_words.push_back(prev_word.Pass()); 123 prev_words.push_back(prev_word.Pass());
123 EXPECT_EQ((int)GetPredictionListClient(prev_words, "").size(), 0); 124 EXPECT_EQ((int)GetPredictionListClient(prev_words, "").size(), 0);
124 } 125 }
125 126
126 } // namespace prediction 127 } // namespace prediction
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698