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

Side by Side Diff: mojo/edk/system/platform_handle_dispatcher_unittest.cc

Issue 2322573002: misc files A-P: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Just rebased Created 4 years, 3 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/edk/system/multiprocess_message_pipe_unittest.cc ('k') | printing/emf_win_unittest.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 "mojo/edk/system/platform_handle_dispatcher.h" 5 #include "mojo/edk/system/platform_handle_dispatcher.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 10 matching lines...) Expand all
21 namespace { 21 namespace {
22 22
23 TEST(PlatformHandleDispatcherTest, Basic) { 23 TEST(PlatformHandleDispatcherTest, Basic) {
24 base::ScopedTempDir temp_dir; 24 base::ScopedTempDir temp_dir;
25 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 25 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
26 26
27 static const char kHelloWorld[] = "hello world"; 27 static const char kHelloWorld[] = "hello world";
28 28
29 base::FilePath unused; 29 base::FilePath unused;
30 base::ScopedFILE fp( 30 base::ScopedFILE fp(
31 CreateAndOpenTemporaryFileInDir(temp_dir.path(), &unused)); 31 CreateAndOpenTemporaryFileInDir(temp_dir.GetPath(), &unused));
32 ASSERT_TRUE(fp); 32 ASSERT_TRUE(fp);
33 EXPECT_EQ(sizeof(kHelloWorld), 33 EXPECT_EQ(sizeof(kHelloWorld),
34 fwrite(kHelloWorld, 1, sizeof(kHelloWorld), fp.get())); 34 fwrite(kHelloWorld, 1, sizeof(kHelloWorld), fp.get()));
35 35
36 ScopedPlatformHandle h(test::PlatformHandleFromFILE(std::move(fp))); 36 ScopedPlatformHandle h(test::PlatformHandleFromFILE(std::move(fp)));
37 EXPECT_FALSE(fp); 37 EXPECT_FALSE(fp);
38 ASSERT_TRUE(h.is_valid()); 38 ASSERT_TRUE(h.is_valid());
39 39
40 scoped_refptr<PlatformHandleDispatcher> dispatcher = 40 scoped_refptr<PlatformHandleDispatcher> dispatcher =
41 PlatformHandleDispatcher::Create(std::move(h)); 41 PlatformHandleDispatcher::Create(std::move(h));
(...skipping 21 matching lines...) Expand all
63 } 63 }
64 64
65 TEST(PlatformHandleDispatcherTest, Serialization) { 65 TEST(PlatformHandleDispatcherTest, Serialization) {
66 base::ScopedTempDir temp_dir; 66 base::ScopedTempDir temp_dir;
67 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 67 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
68 68
69 static const char kFooBar[] = "foo bar"; 69 static const char kFooBar[] = "foo bar";
70 70
71 base::FilePath unused; 71 base::FilePath unused;
72 base::ScopedFILE fp( 72 base::ScopedFILE fp(
73 CreateAndOpenTemporaryFileInDir(temp_dir.path(), &unused)); 73 CreateAndOpenTemporaryFileInDir(temp_dir.GetPath(), &unused));
74 EXPECT_EQ(sizeof(kFooBar), fwrite(kFooBar, 1, sizeof(kFooBar), fp.get())); 74 EXPECT_EQ(sizeof(kFooBar), fwrite(kFooBar, 1, sizeof(kFooBar), fp.get()));
75 75
76 scoped_refptr<PlatformHandleDispatcher> dispatcher = 76 scoped_refptr<PlatformHandleDispatcher> dispatcher =
77 PlatformHandleDispatcher::Create( 77 PlatformHandleDispatcher::Create(
78 test::PlatformHandleFromFILE(std::move(fp))); 78 test::PlatformHandleFromFILE(std::move(fp)));
79 79
80 uint32_t num_bytes = 0; 80 uint32_t num_bytes = 0;
81 uint32_t num_ports = 0; 81 uint32_t num_ports = 0;
82 uint32_t num_handles = 0; 82 uint32_t num_handles = 0;
83 EXPECT_TRUE(dispatcher->BeginTransit()); 83 EXPECT_TRUE(dispatcher->BeginTransit());
(...skipping 30 matching lines...) Expand all
114 EXPECT_EQ(sizeof(kFooBar), 114 EXPECT_EQ(sizeof(kFooBar),
115 fread(read_buffer, 1, sizeof(read_buffer), fp.get())); 115 fread(read_buffer, 1, sizeof(read_buffer), fp.get()));
116 EXPECT_STREQ(kFooBar, read_buffer); 116 EXPECT_STREQ(kFooBar, read_buffer);
117 117
118 EXPECT_EQ(MOJO_RESULT_OK, dispatcher->Close()); 118 EXPECT_EQ(MOJO_RESULT_OK, dispatcher->Close());
119 } 119 }
120 120
121 } // namespace 121 } // namespace
122 } // namespace edk 122 } // namespace edk
123 } // namespace mojo 123 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/multiprocess_message_pipe_unittest.cc ('k') | printing/emf_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698