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

Side by Side Diff: mojo/edk/js/tests/js_to_cpp_tests.cc

Issue 1529303004: Convert Pass()→std::move() in mojo/edk/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/edk/embedder/simple_platform_support.cc ('k') | mojo/edk/system/child_broker.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <utility>
6
5 #include "base/at_exit.h" 7 #include "base/at_exit.h"
6 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
7 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 12 #include "base/run_loop.h"
11 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
12 #include "gin/array_buffer.h" 14 #include "gin/array_buffer.h"
13 #include "gin/public/isolate_holder.h" 15 #include "gin/public/isolate_holder.h"
14 #include "mojo/edk/js/mojo_runner_delegate.h" 16 #include "mojo/edk/js/mojo_runner_delegate.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 args->float_inf = kExpectedFloatInf; 93 args->float_inf = kExpectedFloatInf;
92 args->float_nan = kExpectedFloatNan; 94 args->float_nan = kExpectedFloatNan;
93 args->double_val = kExpectedDoubleVal; 95 args->double_val = kExpectedDoubleVal;
94 args->double_inf = kExpectedDoubleInf; 96 args->double_inf = kExpectedDoubleInf;
95 args->double_nan = kExpectedDoubleNan; 97 args->double_nan = kExpectedDoubleNan;
96 args->name = "coming"; 98 args->name = "coming";
97 Array<String> string_array(3); 99 Array<String> string_array(3);
98 string_array[0] = "one"; 100 string_array[0] = "one";
99 string_array[1] = "two"; 101 string_array[1] = "two";
100 string_array[2] = "three"; 102 string_array[2] = "three";
101 args->string_array = string_array.Pass(); 103 args->string_array = std::move(string_array);
102 return args.Pass(); 104 return args;
103 } 105 }
104 106
105 void CheckSampleEchoArgs(const js_to_cpp::EchoArgs& arg) { 107 void CheckSampleEchoArgs(const js_to_cpp::EchoArgs& arg) {
106 EXPECT_EQ(kExpectedInt64Value, arg.si64); 108 EXPECT_EQ(kExpectedInt64Value, arg.si64);
107 EXPECT_EQ(kExpectedInt32Value, arg.si32); 109 EXPECT_EQ(kExpectedInt32Value, arg.si32);
108 EXPECT_EQ(kExpectedInt16Value, arg.si16); 110 EXPECT_EQ(kExpectedInt16Value, arg.si16);
109 EXPECT_EQ(kExpectedInt8Value, arg.si8); 111 EXPECT_EQ(kExpectedInt8Value, arg.si8);
110 EXPECT_EQ(kExpectedUInt64Value, arg.ui64); 112 EXPECT_EQ(kExpectedUInt64Value, arg.ui64);
111 EXPECT_EQ(kExpectedUInt32Value, arg.ui32); 113 EXPECT_EQ(kExpectedUInt32Value, arg.ui32);
112 EXPECT_EQ(kExpectedUInt16Value, arg.ui16); 114 EXPECT_EQ(kExpectedUInt16Value, arg.ui16);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 binding_(this) {} 203 binding_(this) {}
202 ~CppSideConnection() override {} 204 ~CppSideConnection() override {}
203 205
204 void set_run_loop(base::RunLoop* run_loop) { run_loop_ = run_loop; } 206 void set_run_loop(base::RunLoop* run_loop) { run_loop_ = run_loop; }
205 base::RunLoop* run_loop() { return run_loop_; } 207 base::RunLoop* run_loop() { return run_loop_; }
206 208
207 void set_js_side(js_to_cpp::JsSide* js_side) { js_side_ = js_side; } 209 void set_js_side(js_to_cpp::JsSide* js_side) { js_side_ = js_side; }
208 js_to_cpp::JsSide* js_side() { return js_side_; } 210 js_to_cpp::JsSide* js_side() { return js_side_; }
209 211
210 void Bind(InterfaceRequest<js_to_cpp::CppSide> request) { 212 void Bind(InterfaceRequest<js_to_cpp::CppSide> request) {
211 binding_.Bind(request.Pass()); 213 binding_.Bind(std::move(request));
212 // Keep the pipe open even after validation errors. 214 // Keep the pipe open even after validation errors.
213 binding_.EnableTestingMode(); 215 binding_.EnableTestingMode();
214 } 216 }
215 217
216 // js_to_cpp::CppSide: 218 // js_to_cpp::CppSide:
217 void StartTest() override { NOTREACHED(); } 219 void StartTest() override { NOTREACHED(); }
218 220
219 void TestFinished() override { NOTREACHED(); } 221 void TestFinished() override { NOTREACHED(); }
220 222
221 void PingResponse() override { mishandled_messages_ += 1; } 223 void PingResponse() override { mishandled_messages_ += 1; }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 void RunTest(const std::string& test, CppSideConnection* cpp_side) { 373 void RunTest(const std::string& test, CppSideConnection* cpp_side) {
372 cpp_side->set_run_loop(&run_loop_); 374 cpp_side->set_run_loop(&run_loop_);
373 375
374 js_to_cpp::JsSidePtr js_side; 376 js_to_cpp::JsSidePtr js_side;
375 auto js_side_proxy = GetProxy(&js_side); 377 auto js_side_proxy = GetProxy(&js_side);
376 378
377 cpp_side->set_js_side(js_side.get()); 379 cpp_side->set_js_side(js_side.get());
378 js_to_cpp::CppSidePtr cpp_side_ptr; 380 js_to_cpp::CppSidePtr cpp_side_ptr;
379 cpp_side->Bind(GetProxy(&cpp_side_ptr)); 381 cpp_side->Bind(GetProxy(&cpp_side_ptr));
380 382
381 js_side->SetCppSide(cpp_side_ptr.Pass()); 383 js_side->SetCppSide(std::move(cpp_side_ptr));
382 384
383 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, 385 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
384 gin::IsolateHolder::kStableV8Extras, 386 gin::IsolateHolder::kStableV8Extras,
385 gin::ArrayBufferAllocator::SharedInstance()); 387 gin::ArrayBufferAllocator::SharedInstance());
386 gin::IsolateHolder instance; 388 gin::IsolateHolder instance;
387 MojoRunnerDelegate delegate; 389 MojoRunnerDelegate delegate;
388 gin::ShellRunner runner(&delegate, instance.isolate()); 390 gin::ShellRunner runner(&delegate, instance.isolate());
389 delegate.Start(&runner, js_side_proxy.PassMessagePipe().release().value(), 391 delegate.Start(&runner, js_side_proxy.PassMessagePipe().release().value(),
390 test); 392 test);
391 393
(...skipping 27 matching lines...) Expand all
419 } 421 }
420 422
421 TEST_F(JsToCppTest, BackPointer) { 423 TEST_F(JsToCppTest, BackPointer) {
422 BackPointerCppSideConnection cpp_side_connection; 424 BackPointerCppSideConnection cpp_side_connection;
423 RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection); 425 RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection);
424 EXPECT_TRUE(cpp_side_connection.DidSucceed()); 426 EXPECT_TRUE(cpp_side_connection.DidSucceed());
425 } 427 }
426 428
427 } // namespace edk 429 } // namespace edk
428 } // namespace mojo 430 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/embedder/simple_platform_support.cc ('k') | mojo/edk/system/child_broker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698