| OLD | NEW |
| 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 #import "base/mac/scoped_nsobject.h" | 9 #import "base/mac/scoped_nsobject.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
| 12 #include "base/test/ios/wait_util.h" | 12 #include "base/test/ios/wait_util.h" |
| 13 #include "ios/web/public/test/web_test.h" | 13 #include "ios/web/public/test/web_test.h" |
| 14 #import "ios/web/public/web_state/js/crw_js_injection_evaluator.h" | 14 #import "ios/web/public/web_state/js/crw_js_injection_evaluator.h" |
| 15 #include "ios/web/test/mojo_test.mojom.h" | 15 #include "ios/web/test/mojo_test.mojom.h" |
| 16 #include "mojo/public/cpp/bindings/binding_set.h" | 16 #include "mojo/public/cpp/bindings/binding_set.h" |
| 17 #include "services/shell/public/cpp/identity.h" | 17 #include "services/service_manager/public/cpp/identity.h" |
| 18 #include "services/shell/public/cpp/interface_factory.h" | 18 #include "services/service_manager/public/cpp/interface_factory.h" |
| 19 #include "services/shell/public/cpp/interface_registry.h" | 19 #include "services/service_manager/public/cpp/interface_registry.h" |
| 20 #import "testing/gtest_mac.h" | 20 #import "testing/gtest_mac.h" |
| 21 #import "third_party/ocmock/OCMock/OCMock.h" | 21 #import "third_party/ocmock/OCMock/OCMock.h" |
| 22 | 22 |
| 23 namespace web { | 23 namespace web { |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 // Serializes the given |object| to JSON string. | 27 // Serializes the given |object| to JSON string. |
| 28 std::string GetJson(id object) { | 28 std::string GetJson(id object) { |
| 29 NSData* json_as_data = | 29 NSData* json_as_data = |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 NSDictionary* message = GetObject(facade()->HandleMojoMessage(GetJson(read))); | 269 NSDictionary* message = GetObject(facade()->HandleMojoMessage(GetJson(read))); |
| 270 EXPECT_TRUE([message isKindOfClass:[NSDictionary class]]); | 270 EXPECT_TRUE([message isKindOfClass:[NSDictionary class]]); |
| 271 EXPECT_TRUE(message); | 271 EXPECT_TRUE(message); |
| 272 NSArray* expected_message = @[ @9, @2, @216 ]; // 2008 does not fit 8-bit. | 272 NSArray* expected_message = @[ @9, @2, @216 ]; // 2008 does not fit 8-bit. |
| 273 EXPECT_NSEQ(expected_message, message[@"buffer"]); | 273 EXPECT_NSEQ(expected_message, message[@"buffer"]); |
| 274 EXPECT_FALSE([message[@"handles"] count]); | 274 EXPECT_FALSE([message[@"handles"] count]); |
| 275 EXPECT_EQ(MOJO_RESULT_OK, [message[@"result"] unsignedIntValue]); | 275 EXPECT_EQ(MOJO_RESULT_OK, [message[@"result"] unsignedIntValue]); |
| 276 } | 276 } |
| 277 | 277 |
| 278 } // namespace web | 278 } // namespace web |
| OLD | NEW |