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

Side by Side Diff: ios/web/webui/mojo_facade_unittest.mm

Issue 2182643003: Remove shell::Connection* parameter to InterfaceFactory<T>::Create() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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 #import "ios/web/webui/mojo_facade.h" 5 #import "ios/web/webui/mojo_facade.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #import "base/mac/scoped_nsobject.h" 10 #import "base/mac/scoped_nsobject.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/sys_string_conversions.h" 12 #include "base/strings/sys_string_conversions.h"
13 #include "base/test/ios/wait_util.h" 13 #include "base/test/ios/wait_util.h"
14 #include "ios/web/public/test/web_test.h" 14 #include "ios/web/public/test/web_test.h"
15 #import "ios/web/public/web_state/js/crw_js_injection_evaluator.h" 15 #import "ios/web/public/web_state/js/crw_js_injection_evaluator.h"
16 #include "ios/web/test/mojo_test.mojom.h" 16 #include "ios/web/test/mojo_test.mojom.h"
17 #include "mojo/public/cpp/bindings/binding_set.h" 17 #include "mojo/public/cpp/bindings/binding_set.h"
18 #include "services/shell/public/cpp/identity.h"
18 #include "services/shell/public/cpp/interface_factory.h" 19 #include "services/shell/public/cpp/interface_factory.h"
19 #include "services/shell/public/cpp/interface_registry.h" 20 #include "services/shell/public/cpp/interface_registry.h"
20 #import "testing/gtest_mac.h" 21 #import "testing/gtest_mac.h"
21 #import "third_party/ocmock/OCMock/OCMock.h" 22 #import "third_party/ocmock/OCMock/OCMock.h"
22 23
23 namespace web { 24 namespace web {
24 25
25 namespace { 26 namespace {
26 27
27 // Serializes the given |object| to JSON string. 28 // Serializes the given |object| to JSON string.
(...skipping 15 matching lines...) Expand all
43 error:nil]; 44 error:nil];
44 } 45 }
45 46
46 // Test mojo handler factory. 47 // Test mojo handler factory.
47 class TestUIHandlerFactory : public shell::InterfaceFactory<TestUIHandlerMojo> { 48 class TestUIHandlerFactory : public shell::InterfaceFactory<TestUIHandlerMojo> {
48 public: 49 public:
49 ~TestUIHandlerFactory() override {} 50 ~TestUIHandlerFactory() override {}
50 51
51 private: 52 private:
52 // shell::InterfaceFactory overrides. 53 // shell::InterfaceFactory overrides.
53 void Create(shell::Connection* connection, 54 void Create(const shell::Identity& remote_identity,
54 mojo::InterfaceRequest<TestUIHandlerMojo> request) override {} 55 mojo::InterfaceRequest<TestUIHandlerMojo> request) override {}
55 }; 56 };
56 57
57 } // namespace 58 } // namespace
58 59
59 // A test fixture to test MojoFacade class. 60 // A test fixture to test MojoFacade class.
60 class MojoFacadeTest : public WebTest { 61 class MojoFacadeTest : public WebTest {
61 protected: 62 protected:
62 MojoFacadeTest() { 63 MojoFacadeTest() {
63 interface_registry_.reset(new shell::InterfaceRegistry(nullptr)); 64 interface_registry_.reset(new shell::InterfaceRegistry(nullptr));
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 NSDictionary* message = GetObject(facade()->HandleMojoMessage(GetJson(read))); 268 NSDictionary* message = GetObject(facade()->HandleMojoMessage(GetJson(read)));
268 EXPECT_TRUE([message isKindOfClass:[NSDictionary class]]); 269 EXPECT_TRUE([message isKindOfClass:[NSDictionary class]]);
269 EXPECT_TRUE(message); 270 EXPECT_TRUE(message);
270 NSArray* expected_message = @[ @9, @2, @216 ]; // 2008 does not fit 8-bit. 271 NSArray* expected_message = @[ @9, @2, @216 ]; // 2008 does not fit 8-bit.
271 EXPECT_NSEQ(expected_message, message[@"buffer"]); 272 EXPECT_NSEQ(expected_message, message[@"buffer"]);
272 EXPECT_FALSE([message[@"handles"] count]); 273 EXPECT_FALSE([message[@"handles"] count]);
273 EXPECT_EQ(MOJO_RESULT_OK, [message[@"result"] unsignedIntValue]); 274 EXPECT_EQ(MOJO_RESULT_OK, [message[@"result"] unsignedIntValue]);
274 } 275 }
275 276
276 } // namespace web 277 } // namespace web
OLDNEW
« no previous file with comments | « content/renderer/mus/render_widget_window_tree_client_factory.cc ('k') | ios/web/webui/web_ui_mojo_inttest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698