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

Side by Side Diff: mojo/common/common_custom_types_unittest.cc

Issue 2831073003: Reland of [Memory UMA] Return the extra_processes_dump map as part of the ResponseCallback (Closed)
Patch Set: Created 3 years, 8 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/common/common_custom_types_struct_traits.h ('k') | mojo/common/process_id.mojom » ('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 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 "base/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/files/scoped_temp_dir.h" 6 #include "base/files/scoped_temp_dir.h"
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/numerics/safe_math.h" 9 #include "base/numerics/safe_math.h"
10 #include "base/process/process_handle.h"
10 #include "base/run_loop.h" 11 #include "base/run_loop.h"
11 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
12 #include "base/values.h" 13 #include "base/values.h"
14 #include "mojo/common/common_custom_types_struct_traits.h"
15 #include "mojo/common/process_id.mojom.h"
13 #include "mojo/common/test_common_custom_types.mojom.h" 16 #include "mojo/common/test_common_custom_types.mojom.h"
14 #include "mojo/public/cpp/bindings/binding.h" 17 #include "mojo/public/cpp/bindings/binding.h"
15 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
16 19
17 namespace mojo { 20 namespace mojo {
18 namespace common { 21 namespace common {
19 namespace test { 22 namespace test {
20 namespace { 23 namespace {
21 24
22 template <typename T> 25 template <typename T>
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 TestUnguessableTokenPtr ptr; 222 TestUnguessableTokenPtr ptr;
220 TestUnguessableTokenImpl impl(MakeRequest(&ptr)); 223 TestUnguessableTokenImpl impl(MakeRequest(&ptr));
221 224
222 base::UnguessableToken token = base::UnguessableToken::Create(); 225 base::UnguessableToken token = base::UnguessableToken::Create();
223 226
224 ptr->BounceNonce(token, ExpectResponse(&token, run_loop.QuitClosure())); 227 ptr->BounceNonce(token, ExpectResponse(&token, run_loop.QuitClosure()));
225 228
226 run_loop.Run(); 229 run_loop.Run();
227 } 230 }
228 231
232 TEST_F(CommonCustomTypesTest, ProcessId) {
233 base::ProcessId pid = base::GetCurrentProcId();
234 base::ProcessId out_pid = base::kNullProcessId;
235 ASSERT_NE(pid, out_pid);
236 EXPECT_TRUE(mojom::ProcessId::Deserialize(mojom::ProcessId::Serialize(&pid),
237 &out_pid));
238 EXPECT_EQ(pid, out_pid);
239 }
240
229 TEST_F(CommonCustomTypesTest, Time) { 241 TEST_F(CommonCustomTypesTest, Time) {
230 base::RunLoop run_loop; 242 base::RunLoop run_loop;
231 243
232 TestTimePtr ptr; 244 TestTimePtr ptr;
233 TestTimeImpl impl(MakeRequest(&ptr)); 245 TestTimeImpl impl(MakeRequest(&ptr));
234 246
235 base::Time t = base::Time::Now(); 247 base::Time t = base::Time::Now();
236 248
237 ptr->BounceTime(t, ExpectResponse(&t, run_loop.QuitClosure())); 249 ptr->BounceTime(t, ExpectResponse(&t, run_loop.QuitClosure()));
238 250
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 for (size_t i = 0; i < arraysize(kTestDirections); i++) { 435 for (size_t i = 0; i < arraysize(kTestDirections); i++) {
424 base::i18n::TextDirection direction_out; 436 base::i18n::TextDirection direction_out;
425 ASSERT_TRUE(ptr->BounceTextDirection(kTestDirections[i], &direction_out)); 437 ASSERT_TRUE(ptr->BounceTextDirection(kTestDirections[i], &direction_out));
426 EXPECT_EQ(kTestDirections[i], direction_out); 438 EXPECT_EQ(kTestDirections[i], direction_out);
427 } 439 }
428 } 440 }
429 441
430 } // namespace test 442 } // namespace test
431 } // namespace common 443 } // namespace common
432 } // namespace mojo 444 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/common/common_custom_types_struct_traits.h ('k') | mojo/common/process_id.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698