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

Side by Side Diff: mojo/shell/tests/loader_unittest.cc

Issue 1828733004: Load application manifests from resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « mojo/shell/standalone/context.cc ('k') | no next file » | 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 <utility> 5 #include <utility>
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 loop->Quit(); 395 loop->Quit();
396 } 396 }
397 397
398 class LoaderTest : public testing::Test { 398 class LoaderTest : public testing::Test {
399 public: 399 public:
400 LoaderTest() : tester_context_(&loop_) {} 400 LoaderTest() : tester_context_(&loop_) {}
401 ~LoaderTest() override {} 401 ~LoaderTest() override {}
402 402
403 void SetUp() override { 403 void SetUp() override {
404 blocking_pool_ = new base::SequencedWorkerPool(3, "blocking_pool"); 404 blocking_pool_ = new base::SequencedWorkerPool(3, "blocking_pool");
405 catalog_.reset(new catalog::Factory(blocking_pool_.get(), nullptr)); 405 catalog_.reset(
406 new catalog::Factory(blocking_pool_.get(), nullptr, nullptr));
406 shell_.reset(new Shell(nullptr, catalog_->TakeShellClient())); 407 shell_.reset(new Shell(nullptr, catalog_->TakeShellClient()));
407 test_loader_ = new TestLoader(&context_); 408 test_loader_ = new TestLoader(&context_);
408 shell_->set_default_loader(scoped_ptr<Loader>(test_loader_)); 409 shell_->set_default_loader(scoped_ptr<Loader>(test_loader_));
409 410
410 TestServicePtr service_proxy; 411 TestServicePtr service_proxy;
411 ConnectToInterface(kTestURLString, &service_proxy); 412 ConnectToInterface(kTestURLString, &service_proxy);
412 test_client_.reset(new TestClient(std::move(service_proxy))); 413 test_client_.reset(new TestClient(std::move(service_proxy)));
413 } 414 }
414 415
415 void TearDown() override { 416 void TearDown() override {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 loop_.Run(); 472 loop_.Run();
472 EXPECT_EQ(1, context_.num_impls); 473 EXPECT_EQ(1, context_.num_impls);
473 test_client_.reset(); 474 test_client_.reset();
474 loop_.Run(); 475 loop_.Run();
475 EXPECT_EQ(0, context_.num_impls); 476 EXPECT_EQ(0, context_.num_impls);
476 EXPECT_TRUE(HasRunningInstanceForName(kTestURLString)); 477 EXPECT_TRUE(HasRunningInstanceForName(kTestURLString));
477 } 478 }
478 479
479 TEST_F(LoaderTest, Deletes) { 480 TEST_F(LoaderTest, Deletes) {
480 { 481 {
481 catalog::Factory catalog(blocking_pool_.get(), nullptr); 482 catalog::Factory catalog(blocking_pool_.get(), nullptr, nullptr);
482 Shell shell(nullptr, catalog.TakeShellClient()); 483 Shell shell(nullptr, catalog.TakeShellClient());
483 TestLoader* default_loader = new TestLoader(&context_); 484 TestLoader* default_loader = new TestLoader(&context_);
484 TestLoader* name_loader1 = new TestLoader(&context_); 485 TestLoader* name_loader1 = new TestLoader(&context_);
485 TestLoader* name_loader2 = new TestLoader(&context_); 486 TestLoader* name_loader2 = new TestLoader(&context_);
486 shell.set_default_loader(scoped_ptr<Loader>(default_loader)); 487 shell.set_default_loader(scoped_ptr<Loader>(default_loader));
487 shell.SetLoaderForName(scoped_ptr<Loader>(name_loader1), "test:test1"); 488 shell.SetLoaderForName(scoped_ptr<Loader>(name_loader1), "test:test1");
488 shell.SetLoaderForName(scoped_ptr<Loader>(name_loader2), "test:test1"); 489 shell.SetLoaderForName(scoped_ptr<Loader>(name_loader2), "test:test1");
489 } 490 }
490 EXPECT_EQ(3, context_.num_loader_deletes); 491 EXPECT_EQ(3, context_.num_loader_deletes);
491 } 492 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 EXPECT_EQ(2, test_loader_->num_loads()); 552 EXPECT_EQ(2, test_loader_->num_loads());
552 553
553 // A different identity because the domain is different. 554 // A different identity because the domain is different.
554 ConnectToInterface("test:bar", &test_service); 555 ConnectToInterface("test:bar", &test_service);
555 EXPECT_EQ(3, test_loader_->num_loads()); 556 EXPECT_EQ(3, test_loader_->num_loads());
556 } 557 }
557 558
558 } // namespace test 559 } // namespace test
559 } // namespace shell 560 } // namespace shell
560 } // namespace mojo 561 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/standalone/context.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698