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

Side by Side Diff: shell/application_manager/application_manager_unittest.cc

Issue 2010283006: Almost done: ApplicationDelegate -> ApplicationImplBase conversion. (Closed) Base URL: https://github.com/domokit/mojo.git@work798-x-work797-x-work796_no_run_main_app
Patch Set: rebased Created 4 years, 6 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
« no previous file with comments | « shell/android/native_viewport_application_loader.cc ('k') | shell/context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "shell/application_manager/application_manager.h" 5 #include "shell/application_manager/application_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "mojo/public/cpp/application/application_delegate.h" 14 #include "mojo/public/cpp/application/application_impl_base.h"
15 #include "mojo/public/cpp/application/application_impl.h"
16 #include "mojo/public/cpp/application/connect.h" 15 #include "mojo/public/cpp/application/connect.h"
17 #include "mojo/public/cpp/application/service_provider_impl.h" 16 #include "mojo/public/cpp/application/service_provider_impl.h"
18 #include "mojo/public/cpp/bindings/strong_binding.h" 17 #include "mojo/public/cpp/bindings/strong_binding.h"
19 #include "mojo/public/interfaces/application/service_provider.mojom.h" 18 #include "mojo/public/interfaces/application/service_provider.mojom.h"
20 #include "shell/application_manager/application_loader.h" 19 #include "shell/application_manager/application_loader.h"
21 #include "shell/application_manager/test.mojom.h" 20 #include "shell/application_manager/test.mojom.h"
22 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
23 22
24 using mojo::Application; 23 using mojo::Application;
25 using mojo::ApplicationDelegate; 24 using mojo::ApplicationImplBase;
26 using mojo::ApplicationImpl;
27 using mojo::Callback; 25 using mojo::Callback;
28 using mojo::ConnectionContext; 26 using mojo::ConnectionContext;
29 using mojo::InterfaceRequest; 27 using mojo::InterfaceRequest;
28 using mojo::ServiceProviderImpl;
30 using mojo::StrongBinding; 29 using mojo::StrongBinding;
31 30
32 namespace shell { 31 namespace shell {
33 namespace { 32 namespace {
34 33
35 const char kTestURLString[] = "test:testService"; 34 const char kTestURLString[] = "test:testService";
36 const char kTestAURLString[] = "test:TestA"; 35 const char kTestAURLString[] = "test:TestA";
37 const char kTestBURLString[] = "test:TestB"; 36 const char kTestBURLString[] = "test:TestB";
38 37
39 struct TestContext { 38 struct TestContext {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 base::Bind(&TestClient::AckTest, base::Unretained(this))); 89 base::Bind(&TestClient::AckTest, base::Unretained(this)));
91 } 90 }
92 91
93 private: 92 private:
94 TestServicePtr service_; 93 TestServicePtr service_;
95 bool quit_after_ack_; 94 bool quit_after_ack_;
96 DISALLOW_COPY_AND_ASSIGN(TestClient); 95 DISALLOW_COPY_AND_ASSIGN(TestClient);
97 }; 96 };
98 97
99 class TestApplicationLoader : public ApplicationLoader, 98 class TestApplicationLoader : public ApplicationLoader,
100 public ApplicationDelegate { 99 public ApplicationImplBase {
101 public: 100 public:
102 TestApplicationLoader() : context_(nullptr), num_loads_(0) {} 101 TestApplicationLoader() : context_(nullptr), num_loads_(0) {}
103 102
104 ~TestApplicationLoader() override { 103 ~TestApplicationLoader() override {
105 if (context_) 104 if (context_)
106 ++context_->num_loader_deletes; 105 ++context_->num_loader_deletes;
107 test_app_.reset();
108 } 106 }
109 107
110 void set_context(TestContext* context) { context_ = context; } 108 void set_context(TestContext* context) { context_ = context; }
111 int num_loads() const { return num_loads_; } 109 int num_loads() const { return num_loads_; }
112 const std::vector<std::string>& GetArgs() const { return test_app_->args(); }
113 110
114 private: 111 private:
115 // ApplicationLoader implementation. 112 // ApplicationLoader implementation.
116 void Load(const GURL& url, 113 void Load(const GURL& url,
117 InterfaceRequest<Application> application_request) override { 114 InterfaceRequest<Application> application_request) override {
118 ++num_loads_; 115 ++num_loads_;
119 test_app_.reset(new ApplicationImpl(this, application_request.Pass())); 116 if (application_binding().is_bound())
117 application_binding().Close();
118 Bind(application_request.Pass());
120 } 119 }
121 120
122 // ApplicationDelegate implementation. 121 // ApplicationImplBase override.
123 bool ConfigureIncomingConnection( 122 bool OnAcceptConnection(ServiceProviderImpl* service_provider_impl) override {
124 mojo::ServiceProviderImpl* service_provider_impl) override {
125 service_provider_impl->AddService<TestService>( 123 service_provider_impl->AddService<TestService>(
126 [this](const ConnectionContext& connection_context, 124 [this](const ConnectionContext& connection_context,
127 InterfaceRequest<TestService> request) { 125 InterfaceRequest<TestService> request) {
128 new TestServiceImpl(context_, request.Pass()); 126 new TestServiceImpl(context_, request.Pass());
129 }); 127 });
130 return true; 128 return true;
131 } 129 }
132 130
133 scoped_ptr<ApplicationImpl> test_app_;
134 TestContext* context_; 131 TestContext* context_;
135 int num_loads_; 132 int num_loads_;
136 DISALLOW_COPY_AND_ASSIGN(TestApplicationLoader); 133 DISALLOW_COPY_AND_ASSIGN(TestApplicationLoader);
137 }; 134 };
138 135
139 class ClosingApplicationLoader : public ApplicationLoader { 136 class ClosingApplicationLoader : public ApplicationLoader {
140 private: 137 private:
141 // ApplicationLoader implementation. 138 // ApplicationLoader implementation.
142 void Load(const GURL& url, 139 void Load(const GURL& url,
143 InterfaceRequest<Application> application_request) override {} 140 InterfaceRequest<Application> application_request) override {}
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 private: 283 private:
287 void B(const Callback<void()>& callback) override { 284 void B(const Callback<void()>& callback) override {
288 test_context_->IncrementNumBCalls(); 285 test_context_->IncrementNumBCalls();
289 callback.Run(); 286 callback.Run();
290 } 287 }
291 288
292 TesterContext* test_context_; 289 TesterContext* test_context_;
293 StrongBinding<TestB> binding_; 290 StrongBinding<TestB> binding_;
294 }; 291 };
295 292
296 class Tester : public ApplicationDelegate, public ApplicationLoader { 293 class Tester : public ApplicationImplBase, public ApplicationLoader {
297 public: 294 public:
298 Tester(TesterContext* context, const std::string& requestor_url) 295 Tester(TesterContext* context, const std::string& requestor_url)
299 : context_(context), requestor_url_(requestor_url) {} 296 : context_(context), requestor_url_(requestor_url) {}
300 ~Tester() override {} 297 ~Tester() override {}
301 298
302 private: 299 private:
303 void Load(const GURL& url, 300 void Load(const GURL& url,
304 InterfaceRequest<Application> application_request) override { 301 InterfaceRequest<Application> application_request) override {
305 app_.reset(new ApplicationImpl(this, application_request.Pass())); 302 Bind(application_request.Pass());
306 } 303 }
307 304
308 bool ConfigureIncomingConnection( 305 bool OnAcceptConnection(ServiceProviderImpl* service_provider_impl) override {
309 mojo::ServiceProviderImpl* service_provider_impl) override {
310 const std::string& remote_url = 306 const std::string& remote_url =
311 service_provider_impl->connection_context().remote_url; 307 service_provider_impl->connection_context().remote_url;
312 if (!requestor_url_.empty() && requestor_url_ != remote_url) { 308 if (!requestor_url_.empty() && requestor_url_ != remote_url) {
313 context_->set_tester_called_quit(); 309 context_->set_tester_called_quit();
314 context_->QuitSoon(); 310 context_->QuitSoon();
315 base::MessageLoop::current()->Quit(); 311 base::MessageLoop::current()->Quit();
316 return false; 312 return false;
317 } 313 }
318 // If we're coming from A, then add B, otherwise A. 314 // If we're coming from A, then add B, otherwise A.
319 if (remote_url == kTestAURLString) { 315 if (remote_url == kTestAURLString) {
320 service_provider_impl->AddService<TestB>( 316 service_provider_impl->AddService<TestB>(
321 [this](const ConnectionContext& connection_context, 317 [this](const ConnectionContext& connection_context,
322 InterfaceRequest<TestB> test_b_request) { 318 InterfaceRequest<TestB> test_b_request) {
323 new TestBImpl(context_, test_b_request.Pass()); 319 new TestBImpl(context_, test_b_request.Pass());
324 }); 320 });
325 } else { 321 } else {
326 service_provider_impl->AddService<TestA>( 322 service_provider_impl->AddService<TestA>(
327 [this](const ConnectionContext& connection_context, 323 [this](const ConnectionContext& connection_context,
328 InterfaceRequest<TestA> test_a_request) { 324 InterfaceRequest<TestA> test_a_request) {
329 mojo::InterfaceHandle<mojo::ServiceProvider> incoming_sp_handle; 325 mojo::InterfaceHandle<mojo::ServiceProvider> incoming_sp_handle;
330 app_->shell()->ConnectToApplication( 326 shell()->ConnectToApplication(
331 kTestBURLString, GetProxy(&incoming_sp_handle), nullptr); 327 kTestBURLString, GetProxy(&incoming_sp_handle), nullptr);
332 a_bindings_.push_back(new TestAImpl( 328 a_bindings_.push_back(new TestAImpl(
333 incoming_sp_handle.Pass(), context_, test_a_request.Pass())); 329 incoming_sp_handle.Pass(), context_, test_a_request.Pass()));
334 }); 330 });
335 } 331 }
336 return true; 332 return true;
337 } 333 }
338 334
339 TesterContext* context_; 335 TesterContext* context_;
340 scoped_ptr<ApplicationImpl> app_;
341 std::string requestor_url_; 336 std::string requestor_url_;
342 ScopedVector<TestAImpl> a_bindings_; 337 ScopedVector<TestAImpl> a_bindings_;
343 }; 338 };
344 339
345 class TestDelegate : public ApplicationManager::Delegate { 340 class TestDelegate : public ApplicationManager::Delegate {
346 public: 341 public:
347 void AddMapping(const GURL& from, const GURL& to) { mappings_[from] = to; } 342 void AddMapping(const GURL& from, const GURL& to) { mappings_[from] = to; }
348 343
349 // ApplicationManager::Delegate 344 // ApplicationManager::Delegate
350 GURL ResolveMappings(const GURL& url) override { 345 GURL ResolveMappings(const GURL& url) override {
(...skipping 10 matching lines...) Expand all
361 replacements.SetScheme("file", url::Component(0, 4)); 356 replacements.SetScheme("file", url::Component(0, 4));
362 mapped_url = mapped_url.ReplaceComponents(replacements); 357 mapped_url = mapped_url.ReplaceComponents(replacements);
363 } 358 }
364 return mapped_url; 359 return mapped_url;
365 } 360 }
366 361
367 private: 362 private:
368 std::map<GURL, GURL> mappings_; 363 std::map<GURL, GURL> mappings_;
369 }; 364 };
370 365
371 class TestExternal : public ApplicationDelegate { 366 class TestExternal : public ApplicationImplBase {
372 public: 367 public:
373 TestExternal() : configure_incoming_connection_called_(false) {} 368 TestExternal() : configure_incoming_connection_called_(false) {}
374 369
375 void Initialize(ApplicationImpl* app) override { 370 void OnInitialize() override { base::MessageLoop::current()->Quit(); }
376 initialize_args_ = app->args();
377 base::MessageLoop::current()->Quit();
378 }
379 371
380 bool ConfigureIncomingConnection( 372 bool OnAcceptConnection(ServiceProviderImpl* service_provider_impl) override {
381 mojo::ServiceProviderImpl* service_provider_impl) override {
382 configure_incoming_connection_called_ = true; 373 configure_incoming_connection_called_ = true;
383 base::MessageLoop::current()->Quit(); 374 base::MessageLoop::current()->Quit();
384 return true; 375 return true;
385 } 376 }
386 377
387 const std::vector<std::string>& initialize_args() const { 378 const std::vector<std::string>& initialize_args() const { return args(); }
388 return initialize_args_;
389 }
390 379
391 bool configure_incoming_connection_called() const { 380 bool configure_incoming_connection_called() const {
392 return configure_incoming_connection_called_; 381 return configure_incoming_connection_called_;
393 } 382 }
394 383
395 private: 384 private:
396 std::vector<std::string> initialize_args_;
397 bool configure_incoming_connection_called_; 385 bool configure_incoming_connection_called_;
398 }; 386 };
399 387
400 class ApplicationManagerTest : public testing::Test { 388 class ApplicationManagerTest : public testing::Test {
401 public: 389 public:
402 ApplicationManagerTest() : tester_context_(&loop_) {} 390 ApplicationManagerTest() : tester_context_(&loop_) {}
403 391
404 ~ApplicationManagerTest() override {} 392 ~ApplicationManagerTest() override {}
405 393
406 void SetUp() override { 394 void SetUp() override {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 ApplicationManager am(ApplicationManager::Options(), &test_delegate_); 443 ApplicationManager am(ApplicationManager::Options(), &test_delegate_);
456 GURL test_url("test:test"); 444 GURL test_url("test:test");
457 TestApplicationLoader* loader = new TestApplicationLoader; 445 TestApplicationLoader* loader = new TestApplicationLoader;
458 loader->set_context(&context_); 446 loader->set_context(&context_);
459 am.SetLoaderForURL(scoped_ptr<ApplicationLoader>(loader), test_url); 447 am.SetLoaderForURL(scoped_ptr<ApplicationLoader>(loader), test_url);
460 TestServicePtr test_service; 448 TestServicePtr test_service;
461 am.ConnectToService(test_url, &test_service); 449 am.ConnectToService(test_url, &test_service);
462 TestClient test_client(test_service.Pass()); 450 TestClient test_client(test_service.Pass());
463 test_client.Test("test"); 451 test_client.Test("test");
464 loop_.Run(); 452 loop_.Run();
465 std::vector<std::string> app_args = loader->GetArgs(); 453 std::vector<std::string> app_args = loader->args();
466 EXPECT_EQ(0U, app_args.size()); 454 EXPECT_EQ(0U, app_args.size());
467 } 455 }
468 456
469 // Confirm that arguments are sent to an application. 457 // Confirm that arguments are sent to an application.
470 TEST_F(ApplicationManagerTest, Args) { 458 TEST_F(ApplicationManagerTest, Args) {
471 ApplicationManager am(ApplicationManager::Options(), &test_delegate_); 459 ApplicationManager am(ApplicationManager::Options(), &test_delegate_);
472 GURL test_url("test:test"); 460 GURL test_url("test:test");
473 std::vector<std::string> args; 461 std::vector<std::string> args;
474 args.push_back("test_arg1"); 462 args.push_back("test_arg1");
475 args.push_back("test_arg2"); 463 args.push_back("test_arg2");
476 am.SetArgsForURL(args, test_url); 464 am.SetArgsForURL(args, test_url);
477 TestApplicationLoader* loader = new TestApplicationLoader; 465 TestApplicationLoader* loader = new TestApplicationLoader;
478 loader->set_context(&context_); 466 loader->set_context(&context_);
479 am.SetLoaderForURL(scoped_ptr<ApplicationLoader>(loader), test_url); 467 am.SetLoaderForURL(scoped_ptr<ApplicationLoader>(loader), test_url);
480 TestServicePtr test_service; 468 TestServicePtr test_service;
481 am.ConnectToService(test_url, &test_service); 469 am.ConnectToService(test_url, &test_service);
482 TestClient test_client(test_service.Pass()); 470 TestClient test_client(test_service.Pass());
483 test_client.Test("test"); 471 test_client.Test("test");
484 loop_.Run(); 472 loop_.Run();
485 std::vector<std::string> app_args = loader->GetArgs(); 473 std::vector<std::string> app_args = loader->args();
486 ASSERT_EQ(args.size() + 1, app_args.size()); 474 ASSERT_EQ(args.size() + 1, app_args.size());
487 EXPECT_EQ(args[0], app_args[1]); 475 EXPECT_EQ(args[0], app_args[1]);
488 EXPECT_EQ(args[1], app_args[2]); 476 EXPECT_EQ(args[1], app_args[2]);
489 } 477 }
490 478
491 // Confirm that arguments are sent to an application in the presence of query 479 // Confirm that arguments are sent to an application in the presence of query
492 // parameters. 480 // parameters.
493 TEST_F(ApplicationManagerTest, ArgsWithQuery) { 481 TEST_F(ApplicationManagerTest, ArgsWithQuery) {
494 ApplicationManager am(ApplicationManager::Options(), &test_delegate_); 482 ApplicationManager am(ApplicationManager::Options(), &test_delegate_);
495 GURL test_url("test:test"); 483 GURL test_url("test:test");
496 GURL test_url_with_query("test:test?foo=bar"); 484 GURL test_url_with_query("test:test?foo=bar");
497 std::vector<std::string> args; 485 std::vector<std::string> args;
498 args.push_back("test_arg1"); 486 args.push_back("test_arg1");
499 am.SetArgsForURL(args, test_url); 487 am.SetArgsForURL(args, test_url);
500 TestApplicationLoader* loader = new TestApplicationLoader; 488 TestApplicationLoader* loader = new TestApplicationLoader;
501 loader->set_context(&context_); 489 loader->set_context(&context_);
502 am.SetLoaderForURL(scoped_ptr<ApplicationLoader>(loader), test_url); 490 am.SetLoaderForURL(scoped_ptr<ApplicationLoader>(loader), test_url);
503 TestServicePtr test_service; 491 TestServicePtr test_service;
504 am.ConnectToService(test_url_with_query, &test_service); 492 am.ConnectToService(test_url_with_query, &test_service);
505 TestClient test_client(test_service.Pass()); 493 TestClient test_client(test_service.Pass());
506 test_client.Test("test"); 494 test_client.Test("test");
507 loop_.Run(); 495 loop_.Run();
508 std::vector<std::string> app_args = loader->GetArgs(); 496 std::vector<std::string> app_args = loader->args();
509 ASSERT_EQ(args.size() + 1, app_args.size()); 497 ASSERT_EQ(args.size() + 1, app_args.size());
510 EXPECT_EQ(args[0], app_args[1]); 498 EXPECT_EQ(args[0], app_args[1]);
511 } 499 }
512 500
513 // Confirm that the URL is not duplicated when arguments are added in multiple 501 // Confirm that the URL is not duplicated when arguments are added in multiple
514 // phases. 502 // phases.
515 TEST_F(ApplicationManagerTest, ArgsMultipleCalls) { 503 TEST_F(ApplicationManagerTest, ArgsMultipleCalls) {
516 ApplicationManager am(ApplicationManager::Options(), &test_delegate_); 504 ApplicationManager am(ApplicationManager::Options(), &test_delegate_);
517 GURL test_url("test:test"); 505 GURL test_url("test:test");
518 std::vector<std::string> args1; 506 std::vector<std::string> args1;
519 args1.push_back("test_arg1"); 507 args1.push_back("test_arg1");
520 am.SetArgsForURL(args1, test_url); 508 am.SetArgsForURL(args1, test_url);
521 std::vector<std::string> args2; 509 std::vector<std::string> args2;
522 args2.push_back("test_arg2"); 510 args2.push_back("test_arg2");
523 am.SetArgsForURL(args2, test_url); 511 am.SetArgsForURL(args2, test_url);
524 TestApplicationLoader* loader = new TestApplicationLoader; 512 TestApplicationLoader* loader = new TestApplicationLoader;
525 loader->set_context(&context_); 513 loader->set_context(&context_);
526 am.SetLoaderForURL(scoped_ptr<ApplicationLoader>(loader), test_url); 514 am.SetLoaderForURL(scoped_ptr<ApplicationLoader>(loader), test_url);
527 TestServicePtr test_service; 515 TestServicePtr test_service;
528 am.ConnectToService(test_url, &test_service); 516 am.ConnectToService(test_url, &test_service);
529 TestClient test_client(test_service.Pass()); 517 TestClient test_client(test_service.Pass());
530 test_client.Test("test"); 518 test_client.Test("test");
531 loop_.Run(); 519 loop_.Run();
532 std::vector<std::string> app_args = loader->GetArgs(); 520 std::vector<std::string> app_args = loader->args();
533 ASSERT_EQ(args1.size() + args2.size() + 1, app_args.size()); 521 ASSERT_EQ(args1.size() + args2.size() + 1, app_args.size());
534 EXPECT_EQ(args1[0], app_args[1]); 522 EXPECT_EQ(args1[0], app_args[1]);
535 EXPECT_EQ(args2[0], app_args[2]); 523 EXPECT_EQ(args2[0], app_args[2]);
536 } 524 }
537 525
538 // Confirm that arguments are aggregated through mappings. 526 // Confirm that arguments are aggregated through mappings.
539 TEST_F(ApplicationManagerTest, ArgsAndMapping) { 527 TEST_F(ApplicationManagerTest, ArgsAndMapping) {
540 ApplicationManager am(ApplicationManager::Options(), &test_delegate_); 528 ApplicationManager am(ApplicationManager::Options(), &test_delegate_);
541 GURL test_url("test:test"); 529 GURL test_url("test:test");
542 GURL test_url2("test:test2"); 530 GURL test_url2("test:test2");
543 test_delegate_.AddMapping(test_url, test_url2); 531 test_delegate_.AddMapping(test_url, test_url2);
544 std::vector<std::string> args; 532 std::vector<std::string> args;
545 args.push_back("test_arg1"); 533 args.push_back("test_arg1");
546 args.push_back("test_arg2"); 534 args.push_back("test_arg2");
547 am.SetArgsForURL(args, test_url); 535 am.SetArgsForURL(args, test_url);
548 std::vector<std::string> args2; 536 std::vector<std::string> args2;
549 args2.push_back("test_arg3"); 537 args2.push_back("test_arg3");
550 args2.push_back("test_arg4"); 538 args2.push_back("test_arg4");
551 am.SetArgsForURL(args2, test_url2); 539 am.SetArgsForURL(args2, test_url2);
552 TestApplicationLoader* loader = new TestApplicationLoader; 540 TestApplicationLoader* loader = new TestApplicationLoader;
553 loader->set_context(&context_); 541 loader->set_context(&context_);
554 am.SetLoaderForURL(scoped_ptr<ApplicationLoader>(loader), test_url2); 542 am.SetLoaderForURL(scoped_ptr<ApplicationLoader>(loader), test_url2);
555 { 543 {
556 // Connext to the mapped url 544 // Connext to the mapped url
557 TestServicePtr test_service; 545 TestServicePtr test_service;
558 am.ConnectToService(test_url, &test_service); 546 am.ConnectToService(test_url, &test_service);
559 TestClient test_client(test_service.Pass()); 547 TestClient test_client(test_service.Pass());
560 test_client.Test("test"); 548 test_client.Test("test");
561 loop_.Run(); 549 loop_.Run();
562 std::vector<std::string> app_args = loader->GetArgs(); 550 std::vector<std::string> app_args = loader->args();
563 ASSERT_EQ(args.size() + args2.size() + 1, app_args.size()); 551 ASSERT_EQ(args.size() + args2.size() + 1, app_args.size());
564 EXPECT_EQ(args[0], app_args[1]); 552 EXPECT_EQ(args[0], app_args[1]);
565 EXPECT_EQ(args[1], app_args[2]); 553 EXPECT_EQ(args[1], app_args[2]);
566 EXPECT_EQ(args2[0], app_args[3]); 554 EXPECT_EQ(args2[0], app_args[3]);
567 EXPECT_EQ(args2[1], app_args[4]); 555 EXPECT_EQ(args2[1], app_args[4]);
568 } 556 }
569 { 557 {
570 // Connext to the target url 558 // Connext to the target url
571 TestServicePtr test_service; 559 TestServicePtr test_service;
572 am.ConnectToService(test_url2, &test_service); 560 am.ConnectToService(test_url2, &test_service);
573 TestClient test_client(test_service.Pass()); 561 TestClient test_client(test_service.Pass());
574 test_client.Test("test"); 562 test_client.Test("test");
575 loop_.Run(); 563 loop_.Run();
576 std::vector<std::string> app_args = loader->GetArgs(); 564 std::vector<std::string> app_args = loader->args();
577 ASSERT_EQ(args.size() + args2.size() + 1, app_args.size()); 565 ASSERT_EQ(args.size() + args2.size() + 1, app_args.size());
578 EXPECT_EQ(args[0], app_args[1]); 566 EXPECT_EQ(args[0], app_args[1]);
579 EXPECT_EQ(args[1], app_args[2]); 567 EXPECT_EQ(args[1], app_args[2]);
580 EXPECT_EQ(args2[0], app_args[3]); 568 EXPECT_EQ(args2[0], app_args[3]);
581 EXPECT_EQ(args2[1], app_args[4]); 569 EXPECT_EQ(args2[1], app_args[4]);
582 } 570 }
583 } 571 }
584 572
585 TEST_F(ApplicationManagerTest, ClientError) { 573 TEST_F(ApplicationManagerTest, ClientError) {
586 test_client_->Test("test"); 574 test_client_->Test("test");
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 bool called = false; 771 bool called = false;
784 application_manager_->ConnectToApplication( 772 application_manager_->ConnectToApplication(
785 GURL("test:test"), GURL(), nullptr, 773 GURL("test:test"), GURL(), nullptr,
786 base::Bind(&QuitClosure, base::Unretained(&called))); 774 base::Bind(&QuitClosure, base::Unretained(&called)));
787 loop_.Run(); 775 loop_.Run();
788 EXPECT_TRUE(called); 776 EXPECT_TRUE(called);
789 } 777 }
790 778
791 } // namespace 779 } // namespace
792 } // namespace shell 780 } // namespace shell
OLDNEW
« no previous file with comments | « shell/android/native_viewport_application_loader.cc ('k') | shell/context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698