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

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

Issue 1990603002: Make ApplicationTestBase not use ApplicationImpl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: delete ApplicationImpl::WaitForInitialize() 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"
10 #include "mojo/public/cpp/application/application_test_base.h" 9 #include "mojo/public/cpp/application/application_test_base.h"
11 #include "mojo/public/cpp/application/connect.h" 10 #include "mojo/public/cpp/application/connect.h"
12 #include "mojo/services/prediction/interfaces/prediction.mojom.h" 11 #include "mojo/services/prediction/interfaces/prediction.mojom.h"
13 12
14 namespace prediction { 13 namespace prediction {
15 14
16 void GetPredictionListAndEnd(std::vector<std::string>* output_list, 15 void GetPredictionListAndEnd(std::vector<std::string>* output_list,
17 const mojo::Array<mojo::String>& input_list) { 16 const mojo::Array<mojo::String>& input_list) {
18 *output_list = input_list.To<std::vector<std::string>>(); 17 *output_list = input_list.To<std::vector<std::string>>();
19 base::MessageLoop::current()->Quit(); 18 base::MessageLoop::current()->Quit();
20 } 19 }
21 20
22 class PredictionApptest : public mojo::test::ApplicationTestBase { 21 class PredictionApptest : public mojo::test::ApplicationTestBase {
23 public: 22 public:
24 PredictionApptest() : ApplicationTestBase() {} 23 PredictionApptest() : ApplicationTestBase() {}
25 24
26 ~PredictionApptest() override {} 25 ~PredictionApptest() override {}
27 26
28 void SetUp() override { 27 void SetUp() override {
29 mojo::test::ApplicationTestBase::SetUp(); 28 mojo::test::ApplicationTestBase::SetUp();
30 mojo::ConnectToService(application_impl()->shell(), 29 mojo::ConnectToService(shell(), "mojo:prediction_service",
31 "mojo:prediction_service", GetProxy(&prediction_)); 30 GetProxy(&prediction_));
32 } 31 }
33 32
34 std::vector<std::string> GetPredictionListClient( 33 std::vector<std::string> GetPredictionListClient(
35 mojo::Array<PrevWordInfoPtr>& prev_words, 34 mojo::Array<PrevWordInfoPtr>& prev_words,
36 const mojo::String& cur_word) { 35 const mojo::String& cur_word) {
37 PredictionInfoPtr prediction_info = PredictionInfo::New(); 36 PredictionInfoPtr prediction_info = PredictionInfo::New();
38 prediction_info->previous_words = prev_words.Pass(); 37 prediction_info->previous_words = prev_words.Pass();
39 prediction_info->current_word = cur_word; 38 prediction_info->current_word = cur_word;
40 39
41 std::vector<std::string> prediction_list; 40 std::vector<std::string> prediction_list;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 PrevWordInfoPtr prev_word = PrevWordInfo::New(); 117 PrevWordInfoPtr prev_word = PrevWordInfo::New();
119 prev_word->word = "This"; 118 prev_word->word = "This";
120 prev_word->is_beginning_of_sentence = true; 119 prev_word->is_beginning_of_sentence = true;
121 mojo::Array<PrevWordInfoPtr> prev_words = 120 mojo::Array<PrevWordInfoPtr> prev_words =
122 mojo::Array<PrevWordInfoPtr>::New(0); 121 mojo::Array<PrevWordInfoPtr>::New(0);
123 prev_words.push_back(prev_word.Pass()); 122 prev_words.push_back(prev_word.Pass());
124 EXPECT_EQ((int)GetPredictionListClient(prev_words, "").size(), 0); 123 EXPECT_EQ((int)GetPredictionListClient(prev_words, "").size(), 0);
125 } 124 }
126 125
127 } // namespace prediction 126 } // namespace prediction
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698