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

Side by Side Diff: mojo/shell/public/cpp/lib/shell_test.cc

Issue 1780973004: Kill ShellConnection::WaitForInitialize (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fuse-api
Patch Set: Created 4 years, 9 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/public/cpp/lib/shell_connection.cc ('k') | mojo/shell/public/cpp/shell_connection.h » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "mojo/shell/public/cpp/shell_test.h" 5 #include "mojo/shell/public/cpp/shell_test.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "mojo/shell/background/background_shell.h" 8 #include "mojo/shell/background/background_shell.h"
9 #include "mojo/shell/public/cpp/shell_client.h" 9 #include "mojo/shell/public/cpp/shell_client.h"
10 10
11 namespace mojo { 11 namespace mojo {
12 namespace test { 12 namespace test {
13 13
14 ShellTestClient::ShellTestClient(ShellTest* test) : test_(test) {} 14 ShellTestClient::ShellTestClient(ShellTest* test) : test_(test) {}
15 ShellTestClient::~ShellTestClient() {} 15 ShellTestClient::~ShellTestClient() {}
16 16
17 void ShellTestClient::Initialize(Connector* connector, const Identity& identity, 17 void ShellTestClient::Initialize(Connector* connector, const Identity& identity,
18 uint32_t id) { 18 uint32_t id) {
19 test_->InitializeCalled(connector, identity.name(), identity.user_id(), id); 19 test_->InitializeCalled(identity.name(), identity.user_id(), id);
20 } 20 }
21 21
22 ShellTest::ShellTest() {} 22 ShellTest::ShellTest() {}
23 ShellTest::ShellTest(const std::string& test_name) : test_name_(test_name) {} 23 ShellTest::ShellTest(const std::string& test_name) : test_name_(test_name) {}
24 ShellTest::~ShellTest() {} 24 ShellTest::~ShellTest() {}
25 25
26 void ShellTest::InitTestName(const std::string& test_name) { 26 void ShellTest::InitTestName(const std::string& test_name) {
27 DCHECK(test_name_.empty()); 27 DCHECK(test_name_.empty());
28 test_name_ = test_name; 28 test_name_ = test_name;
29 } 29 }
30 30
31 scoped_ptr<ShellClient> ShellTest::CreateShellClient() { 31 scoped_ptr<ShellClient> ShellTest::CreateShellClient() {
32 return make_scoped_ptr(new ShellTestClient(this)); 32 return make_scoped_ptr(new ShellTestClient(this));
33 } 33 }
34 34
35 void ShellTest::InitializeCalled(Connector* connector, 35 void ShellTest::InitializeCalled(const std::string& name,
36 const std::string& name,
37 const std::string& user_id, 36 const std::string& user_id,
38 uint32_t id) { 37 uint32_t id) {
39 connector_ = connector;
40 initialize_name_ = name; 38 initialize_name_ = name;
41 initialize_instance_id_ = id; 39 initialize_instance_id_ = id;
42 initialize_userid_ = user_id; 40 initialize_userid_ = user_id;
43 } 41 }
44 42
45 void ShellTest::SetUp() { 43 void ShellTest::SetUp() {
46 shell_client_ = CreateShellClient(); 44 shell_client_ = CreateShellClient();
47 message_loop_.reset(new base::MessageLoop); 45 message_loop_.reset(new base::MessageLoop);
48 background_shell_.reset(new shell::BackgroundShell); 46 background_shell_.reset(new shell::BackgroundShell);
49 background_shell_->Init(nullptr); 47 background_shell_->Init(nullptr);
50 shell_connection_.reset(new ShellConnection( 48 shell_connection_.reset(new ShellConnection(
51 shell_client_.get(), 49 shell_client_.get(),
52 background_shell_->CreateShellClientRequest(test_name_))); 50 background_shell_->CreateShellClientRequest(test_name_)));
53 shell_connection_->WaitForInitialize(); 51 connector_ = shell_connection_->connector();
54 } 52 }
55 53
56 void ShellTest::TearDown() { 54 void ShellTest::TearDown() {
57 shell_connection_.reset(); 55 shell_connection_.reset();
58 background_shell_.reset(); 56 background_shell_.reset();
59 message_loop_.reset(); 57 message_loop_.reset();
60 shell_client_.reset(); 58 shell_client_.reset();
61 } 59 }
62 60
63 } // namespace test 61 } // namespace test
64 } // namespace mojo 62 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/public/cpp/lib/shell_connection.cc ('k') | mojo/shell/public/cpp/shell_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698