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

Side by Side Diff: mojo/shell/capability_filter_test.h

Issue 1675083002: Rename ApplicationDelegate to ShellClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@delegate
Patch Set: . Created 4 years, 10 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/application_package_apptest.cc ('k') | mojo/shell/capability_filter_test.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 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 #include "base/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "mojo/shell/application_loader.h" 9 #include "mojo/shell/application_loader.h"
10 #include "mojo/shell/application_manager.h" 10 #include "mojo/shell/application_manager.h"
11 #include "mojo/shell/capability_filter_unittest.mojom.h" 11 #include "mojo/shell/capability_filter_unittest.mojom.h"
12 #include "mojo/shell/public/cpp/application_delegate.h" 12 #include "mojo/shell/public/cpp/application_impl.h"
13 #include "mojo/shell/public/cpp/shell_client.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
15 namespace mojo { 16 namespace mojo {
16 namespace shell { 17 namespace shell {
17 namespace test { 18 namespace test {
18 19
19 class ConnectionValidator; 20 class ConnectionValidator;
20 21
21 // This class models an application who will use the shell to interact with a 22 // This class models an application who will use the shell to interact with a
22 // system service. The shell may limit this application's visibility of the full 23 // system service. The shell may limit this application's visibility of the full
23 // set of interfaces exposed by that service. 24 // set of interfaces exposed by that service.
24 class TestApplication : public ApplicationDelegate { 25 class TestApplication : public ShellClient {
25 public: 26 public:
26 TestApplication(); 27 TestApplication();
27 ~TestApplication() override; 28 ~TestApplication() override;
28 29
29 private: 30 private:
30 // Overridden from ApplicationDelegate: 31 // Overridden from ShellClient:
31 void Initialize(Shell* shell, const std::string& url, uint32_t id) override; 32 void Initialize(Shell* shell, const std::string& url, uint32_t id) override;
32 bool AcceptConnection(ApplicationConnection* connection) override; 33 bool AcceptConnection(Connection* connection) override;
33 34
34 void ConnectionClosed(const std::string& service_url); 35 void ConnectionClosed(const std::string& service_url);
35 36
36 Shell* shell_; 37 Shell* shell_;
37 std::string url_; 38 std::string url_;
38 ValidatorPtr validator_; 39 ValidatorPtr validator_;
39 scoped_ptr<ApplicationConnection> connection1_; 40 scoped_ptr<Connection> connection1_;
40 scoped_ptr<ApplicationConnection> connection2_; 41 scoped_ptr<Connection> connection2_;
41 42
42 DISALLOW_COPY_AND_ASSIGN(TestApplication); 43 DISALLOW_COPY_AND_ASSIGN(TestApplication);
43 }; 44 };
44 45
45 class TestLoader : public ApplicationLoader { 46 class TestLoader : public ApplicationLoader {
46 public: 47 public:
47 explicit TestLoader(ApplicationDelegate* delegate); 48 explicit TestLoader(ShellClient* delegate);
48 ~TestLoader() override; 49 ~TestLoader() override;
49 50
50 private: 51 private:
51 // Overridden from ApplicationLoader: 52 // Overridden from ApplicationLoader:
52 void Load(const GURL& url, 53 void Load(const GURL& url,
53 InterfaceRequest<mojom::Application> request) override; 54 InterfaceRequest<mojom::Application> request) override;
54 55
55 scoped_ptr<ApplicationDelegate> delegate_; 56 scoped_ptr<ShellClient> delegate_;
56 scoped_ptr<ApplicationImpl> app_; 57 scoped_ptr<ApplicationImpl> app_;
57 58
58 DISALLOW_COPY_AND_ASSIGN(TestLoader); 59 DISALLOW_COPY_AND_ASSIGN(TestLoader);
59 }; 60 };
60 61
61 class CapabilityFilterTest : public testing::Test { 62 class CapabilityFilterTest : public testing::Test {
62 public: 63 public:
63 CapabilityFilterTest(); 64 CapabilityFilterTest();
64 ~CapabilityFilterTest() override; 65 ~CapabilityFilterTest() override;
65 66
(...skipping 20 matching lines...) Expand all
86 return application_manager_.get(); 87 return application_manager_.get();
87 } 88 }
88 ConnectionValidator* validator() { return validator_; } 89 ConnectionValidator* validator() { return validator_; }
89 90
90 private: 91 private:
91 void RunApplication(const std::string& url, const CapabilityFilter& filter); 92 void RunApplication(const std::string& url, const CapabilityFilter& filter);
92 void InitValidator(const std::set<std::string>& expectations); 93 void InitValidator(const std::set<std::string>& expectations);
93 void RunTest(); 94 void RunTest();
94 95
95 template<class T> 96 template<class T>
96 scoped_ptr<ApplicationDelegate> CreateApplicationDelegate() { 97 scoped_ptr<ShellClient> CreateShellClient() {
97 return scoped_ptr<ApplicationDelegate>(new T); 98 return scoped_ptr<ShellClient>(new T);
98 } 99 }
99 100
100 base::ShadowingAtExitManager at_exit_; 101 base::ShadowingAtExitManager at_exit_;
101 base::MessageLoop loop_; 102 base::MessageLoop loop_;
102 scoped_ptr<ApplicationManager> application_manager_; 103 scoped_ptr<ApplicationManager> application_manager_;
103 ConnectionValidator* validator_; 104 ConnectionValidator* validator_;
104 105
105 DISALLOW_COPY_AND_ASSIGN(CapabilityFilterTest); 106 DISALLOW_COPY_AND_ASSIGN(CapabilityFilterTest);
106 }; 107 };
107 108
108 } // namespace test 109 } // namespace test
109 } // namespace shell 110 } // namespace shell
110 } // namespace mojo 111 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/application_package_apptest.cc ('k') | mojo/shell/capability_filter_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698