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

Unified Diff: mojo/edk/system/platform_handle_dispatcher_unittest.cc

Issue 1354433003: Add a mojo::test::ScopedTestDir and convert tests to use it. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/system/multiprocess_message_pipe_unittest.cc ('k') | mojo/edk/system/raw_channel_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/platform_handle_dispatcher_unittest.cc
diff --git a/mojo/edk/system/platform_handle_dispatcher_unittest.cc b/mojo/edk/system/platform_handle_dispatcher_unittest.cc
index f3426a20f3a08b1f01dcb31082c0556d6b8141c4..ecc4d3e5cd74cd64c361f54f530242a57c6c435f 100644
--- a/mojo/edk/system/platform_handle_dispatcher_unittest.cc
+++ b/mojo/edk/system/platform_handle_dispatcher_unittest.cc
@@ -6,10 +6,8 @@
#include <stdio.h>
-#include "base/files/file_path.h"
-#include "base/files/file_util.h"
-#include "base/files/scoped_temp_dir.h"
#include "base/memory/ref_counted.h"
+#include "mojo/edk/test/scoped_test_dir.h"
#include "mojo/edk/test/test_utils.h"
#include "mojo/edk/util/scoped_file.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -19,14 +17,11 @@ namespace system {
namespace {
TEST(PlatformHandleDispatcherTest, Basic) {
- base::ScopedTempDir temp_dir;
- ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
+ mojo::test::ScopedTestDir test_dir;
static const char kHelloWorld[] = "hello world";
- base::FilePath unused;
- util::ScopedFILE fp(
- CreateAndOpenTemporaryFileInDir(temp_dir.path(), &unused));
+ util::ScopedFILE fp(test_dir.CreateFile());
ASSERT_TRUE(fp);
EXPECT_EQ(sizeof(kHelloWorld),
fwrite(kHelloWorld, 1, sizeof(kHelloWorld), fp.get()));
@@ -62,14 +57,11 @@ TEST(PlatformHandleDispatcherTest, Basic) {
}
TEST(PlatformHandleDispatcherTest, CreateEquivalentDispatcherAndClose) {
- base::ScopedTempDir temp_dir;
- ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
+ mojo::test::ScopedTestDir test_dir;
static const char kFooBar[] = "foo bar";
- base::FilePath unused;
- util::ScopedFILE fp(
- CreateAndOpenTemporaryFileInDir(temp_dir.path(), &unused));
+ util::ScopedFILE fp(test_dir.CreateFile());
EXPECT_EQ(sizeof(kFooBar), fwrite(kFooBar, 1, sizeof(kFooBar), fp.get()));
scoped_refptr<PlatformHandleDispatcher> dispatcher =
« no previous file with comments | « mojo/edk/system/multiprocess_message_pipe_unittest.cc ('k') | mojo/edk/system/raw_channel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698