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

Side by Side Diff: content/browser/utility_process_mojo_client_browsertest.cc

Issue 2387263002: Rename MojoShellContext -> ServiceManagerContext. (Closed)
Patch Set: . Created 4 years, 2 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 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 "content/public/browser/utility_process_mojo_client.h" 5 #include "content/public/browser/utility_process_mojo_client.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "content/public/common/content_switches.h" 14 #include "content/public/common/content_switches.h"
15 #include "content/public/test/content_browser_test.h" 15 #include "content/public/test/content_browser_test.h"
16 #include "content/public/test/test_mojo_service.mojom.h" 16 #include "content/public/test/test_service.mojom.h"
17 17
18 namespace content { 18 namespace content {
19 19
20 // Test fixture used to make different Mojo calls to the utility process. 20 // Test fixture used to make different Mojo calls to the utility process.
21 class UtilityProcessMojoClientBrowserTest : public ContentBrowserTest { 21 class UtilityProcessMojoClientBrowserTest : public ContentBrowserTest {
22 public: 22 public:
23 void StartMojoService(bool disable_sandbox) { 23 void StartMojoService(bool disable_sandbox) {
24 mojo_client_.reset(new UtilityProcessMojoClient<mojom::TestMojoService>( 24 mojo_client_.reset(new UtilityProcessMojoClient<mojom::TestService>(
25 base::ASCIIToUTF16("TestMojoProcess"))); 25 base::ASCIIToUTF16("TestMojoProcess")));
26 26
27 mojo_client_->set_error_callback( 27 mojo_client_->set_error_callback(
28 base::Bind(&UtilityProcessMojoClientBrowserTest::OnConnectionError, 28 base::Bind(&UtilityProcessMojoClientBrowserTest::OnConnectionError,
29 base::Unretained(this))); 29 base::Unretained(this)));
30 30
31 // This test case needs to have the sandbox disabled. 31 // This test case needs to have the sandbox disabled.
32 if (disable_sandbox) 32 if (disable_sandbox)
33 mojo_client_->set_disable_sandbox(); 33 mojo_client_->set_disable_sandbox();
34 mojo_client_->Start(); 34 mojo_client_->Start();
(...skipping 14 matching lines...) Expand all
49 } 49 }
50 50
51 // Called when a responsed is received from a call to CreateFolder(). 51 // Called when a responsed is received from a call to CreateFolder().
52 void OnCreateFolderFinished(bool succeeded) { 52 void OnCreateFolderFinished(bool succeeded) {
53 response_received_ = true; 53 response_received_ = true;
54 sandbox_succeeded_ = succeeded; 54 sandbox_succeeded_ = succeeded;
55 done_closure_.Run(); 55 done_closure_.Run();
56 } 56 }
57 57
58 protected: 58 protected:
59 std::unique_ptr<UtilityProcessMojoClient<mojom::TestMojoService>> 59 std::unique_ptr<UtilityProcessMojoClient<mojom::TestService>>
60 mojo_client_; 60 mojo_client_;
61 base::Closure done_closure_; 61 base::Closure done_closure_;
62 62
63 // The test result that is compared to the current test case. 63 // The test result that is compared to the current test case.
64 bool response_received_ = false; 64 bool response_received_ = false;
65 bool error_happened_ = false; 65 bool error_happened_ = false;
66 bool sandbox_succeeded_ = false; 66 bool sandbox_succeeded_ = false;
67 }; 67 };
68 68
69 // Successful call through the Mojo service with response back. 69 // Successful call through the Mojo service with response back.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 base::Unretained(this))); 132 base::Unretained(this)));
133 133
134 run_loop.Run(); 134 run_loop.Run();
135 EXPECT_TRUE(response_received_); 135 EXPECT_TRUE(response_received_);
136 EXPECT_TRUE(sandbox_succeeded_); 136 EXPECT_TRUE(sandbox_succeeded_);
137 EXPECT_FALSE(error_happened_); 137 EXPECT_FALSE(error_happened_);
138 } 138 }
139 #endif 139 #endif
140 140
141 } // namespace content 141 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/utility_process_host_impl_browsertest.cc ('k') | content/public/test/test_mojo_app.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698