diff options
-rw-r--r-- | mojo/edk/PRESUBMIT.py (renamed from mojo/edk/system/PRESUBMIT.py) | 2 | ||||
-rw-r--r-- | mojo/edk/embedder/PRESUBMIT.py | 16 | ||||
-rw-r--r-- | mojo/edk/embedder/platform_channel_pair_win.cc | 4 | ||||
-rw-r--r-- | mojo/edk/system/data_pipe.cc | 3 | ||||
-rw-r--r-- | mojo/edk/system/dispatcher.h | 2 | ||||
-rw-r--r-- | mojo/edk/system/memory.cc | 4 | ||||
-rw-r--r-- | mojo/edk/test/multiprocess_test_helper.h | 22 | ||||
-rw-r--r-- | mojo/edk/test/multiprocess_test_helper_unittest.cc | 13 | ||||
-rw-r--r-- | mojo/edk/test/run_all_unittests.cc | 5 | ||||
-rw-r--r-- | mojo/edk/test/test_support_impl.cc | 3 | ||||
-rw-r--r-- | mojo/edk/test/test_support_impl.h | 4 | ||||
-rw-r--r-- | mojo/edk/test/test_utils_win.cc | 49 |
12 files changed, 63 insertions, 64 deletions
diff --git a/mojo/edk/system/PRESUBMIT.py b/mojo/edk/PRESUBMIT.py index 2827571..43d5417 100644 --- a/mojo/edk/system/PRESUBMIT.py +++ b/mojo/edk/PRESUBMIT.py @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -"""Presubmit script for mojo/edk/system. +"""Presubmit script for mojo/edk. See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details about the presubmit API built into depot_tools. diff --git a/mojo/edk/embedder/PRESUBMIT.py b/mojo/edk/embedder/PRESUBMIT.py deleted file mode 100644 index 9cd39bc..0000000 --- a/mojo/edk/embedder/PRESUBMIT.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Presubmit script for mojo/edk/embedder. - -See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts -for more details about the presubmit API built into depot_tools. -""" - -def CheckChangeOnUpload(input_api, output_api): - results = [] - results += input_api.canned_checks.CheckChangeHasOnlyOneEol(input_api, - output_api) - results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api) - return results diff --git a/mojo/edk/embedder/platform_channel_pair_win.cc b/mojo/edk/embedder/platform_channel_pair_win.cc index 1cafc4f..4804eed 100644 --- a/mojo/edk/embedder/platform_channel_pair_win.cc +++ b/mojo/edk/embedder/platform_channel_pair_win.cc @@ -53,8 +53,8 @@ PlatformChannelPair::PlatformChannelPair() { const DWORD kFlags = SECURITY_SQOS_PRESENT | SECURITY_ANONYMOUS | FILE_FLAG_OVERLAPPED; // Allow the handle to be inherited by child processes. - SECURITY_ATTRIBUTES security_attributes = {sizeof(SECURITY_ATTRIBUTES), - nullptr, TRUE}; + SECURITY_ATTRIBUTES security_attributes = { + sizeof(SECURITY_ATTRIBUTES), nullptr, TRUE}; client_handle_.reset( PlatformHandle(CreateFileW(pipe_name.c_str(), kDesiredAccess, diff --git a/mojo/edk/system/data_pipe.cc b/mojo/edk/system/data_pipe.cc index 3aca67a..ace5fd3 100644 --- a/mojo/edk/system/data_pipe.cc +++ b/mojo/edk/system/data_pipe.cc @@ -22,7 +22,8 @@ namespace system { // static const MojoCreateDataPipeOptions DataPipe::kDefaultCreateOptions = { static_cast<uint32_t>(sizeof(MojoCreateDataPipeOptions)), - MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE, 1u, + MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE, + 1u, static_cast<uint32_t>(kDefaultDataPipeCapacityBytes)}; // static diff --git a/mojo/edk/system/dispatcher.h b/mojo/edk/system/dispatcher.h index 3e2230a..8d3edd4 100644 --- a/mojo/edk/system/dispatcher.h +++ b/mojo/edk/system/dispatcher.h @@ -226,7 +226,7 @@ class MOJO_SYSTEM_IMPL_EXPORT Dispatcher virtual void CancelAllWaitersNoLock(); virtual void CloseImplNoLock(); virtual scoped_refptr<Dispatcher> - CreateEquivalentDispatcherAndCloseImplNoLock() = 0; + CreateEquivalentDispatcherAndCloseImplNoLock() = 0; // These are to be overridden by subclasses (if necessary). They are never // called after the dispatcher has been closed. They are called under |lock_|. diff --git a/mojo/edk/system/memory.cc b/mojo/edk/system/memory.cc index 606c08f..1d7f792 100644 --- a/mojo/edk/system/memory.cc +++ b/mojo/edk/system/memory.cc @@ -40,7 +40,7 @@ template void MOJO_SYSTEM_IMPL_EXPORT CheckUserPointer<8, 8>(const void*); template <size_t size, size_t alignment> void MOJO_SYSTEM_IMPL_EXPORT -CheckUserPointerWithCount(const void* pointer, size_t count) { + CheckUserPointerWithCount(const void* pointer, size_t count) { CHECK_LE(count, std::numeric_limits<size_t>::max() / size); CHECK(count == 0 || (pointer && IsAligned<alignment>(pointer))); } @@ -75,7 +75,7 @@ template void MOJO_SYSTEM_IMPL_EXPORT #if defined(COMPILER_MSVC) && defined(ARCH_CPU_32_BITS) template <> void MOJO_SYSTEM_IMPL_EXPORT -CheckUserPointerWithSize<8>(const void* pointer, size_t size) { + CheckUserPointerWithSize<8>(const void* pointer, size_t size) { CHECK(size == 0 || (!!pointer && reinterpret_cast<uintptr_t>(pointer) % 8 == 0)); } diff --git a/mojo/edk/test/multiprocess_test_helper.h b/mojo/edk/test/multiprocess_test_helper.h index ea77544..6b2713f 100644 --- a/mojo/edk/test/multiprocess_test_helper.h +++ b/mojo/edk/test/multiprocess_test_helper.h @@ -68,22 +68,24 @@ class MultiprocessTestHelper { // |MultiprocessTestHelper|. It returns an |int|, which will be the process's // exit code (but see the comment about |WaitForChildShutdown()|). #define MOJO_MULTIPROCESS_TEST_CHILD_MAIN(test_child_name) \ - MULTIPROCESS_TEST_MAIN_WITH_SETUP( \ - test_child_name ## TestChildMain, \ - ::mojo::test::MultiprocessTestHelper::ChildSetup) + MULTIPROCESS_TEST_MAIN_WITH_SETUP( \ + test_child_name##TestChildMain, \ + ::mojo::test::MultiprocessTestHelper::ChildSetup) // Use this (and |WaitForChildTestShutdown()|) for the child process's "main()", // if you want to use |EXPECT_...()| or |ASSERT_...()|; it has a |void| return // type. (Note that while an |ASSERT_...()| failure will abort the test in the // child, it will not abort the test in the parent.) #define MOJO_MULTIPROCESS_TEST_CHILD_TEST(test_child_name) \ - void test_child_name ## TestChildTest(); \ - MOJO_MULTIPROCESS_TEST_CHILD_MAIN(test_child_name) { \ - test_child_name ## TestChildTest(); \ - return (::testing::Test::HasFatalFailure() || \ - ::testing::Test::HasNonfatalFailure()) ? 1 : 0; \ - } \ - void test_child_name ## TestChildTest() + void test_child_name##TestChildTest(); \ + MOJO_MULTIPROCESS_TEST_CHILD_MAIN(test_child_name) { \ + test_child_name##TestChildTest(); \ + return (::testing::Test::HasFatalFailure() || \ + ::testing::Test::HasNonfatalFailure()) \ + ? 1 \ + : 0; \ + } \ + void test_child_name##TestChildTest() } // namespace test } // namespace mojo diff --git a/mojo/edk/test/multiprocess_test_helper_unittest.cc b/mojo/edk/test/multiprocess_test_helper_unittest.cc index ec2ba22..2961a74 100644 --- a/mojo/edk/test/multiprocess_test_helper_unittest.cc +++ b/mojo/edk/test/multiprocess_test_helper_unittest.cc @@ -118,8 +118,8 @@ TEST_F(MultiprocessTestHelperTest, ChildTestPasses) { MOJO_MULTIPROCESS_TEST_CHILD_TEST(ChildTestPasses) { ASSERT_TRUE(MultiprocessTestHelper::client_platform_handle.is_valid()); - EXPECT_TRUE(IsNonBlocking( - MultiprocessTestHelper::client_platform_handle.get())); + EXPECT_TRUE( + IsNonBlocking(MultiprocessTestHelper::client_platform_handle.get())); } TEST_F(MultiprocessTestHelperTest, ChildTestFailsAssert) { @@ -132,8 +132,9 @@ TEST_F(MultiprocessTestHelperTest, ChildTestFailsAssert) { MOJO_MULTIPROCESS_TEST_CHILD_TEST(ChildTestFailsAssert) { ASSERT_FALSE(MultiprocessTestHelper::client_platform_handle.is_valid()) << "DISREGARD: Expected failure in child process"; - ASSERT_FALSE(IsNonBlocking( - MultiprocessTestHelper::client_platform_handle.get())) << "Not reached"; + ASSERT_FALSE( + IsNonBlocking(MultiprocessTestHelper::client_platform_handle.get())) + << "Not reached"; CHECK(false) << "Not reached"; } @@ -147,8 +148,8 @@ TEST_F(MultiprocessTestHelperTest, ChildTestFailsExpect) { MOJO_MULTIPROCESS_TEST_CHILD_TEST(ChildTestFailsExpect) { EXPECT_FALSE(MultiprocessTestHelper::client_platform_handle.is_valid()) << "DISREGARD: Expected failure #1 in child process"; - EXPECT_FALSE(IsNonBlocking( - MultiprocessTestHelper::client_platform_handle.get())) + EXPECT_FALSE( + IsNonBlocking(MultiprocessTestHelper::client_platform_handle.get())) << "DISREGARD: Expected failure #2 in child process"; } diff --git a/mojo/edk/test/run_all_unittests.cc b/mojo/edk/test/run_all_unittests.cc index 6805dcd..c66ea50 100644 --- a/mojo/edk/test/run_all_unittests.cc +++ b/mojo/edk/test/run_all_unittests.cc @@ -21,6 +21,7 @@ int main(int argc, char** argv) { mojo::test::TestSupport::Init(new mojo::test::TestSupportImpl()); return base::LaunchUnitTests( - argc, argv, base::Bind(&base::TestSuite::Run, - base::Unretained(&test_suite))); + argc, + argv, + base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); } diff --git a/mojo/edk/test/test_support_impl.cc b/mojo/edk/test/test_support_impl.cc index fae3a8f..2a86331 100644 --- a/mojo/edk/test/test_support_impl.cc +++ b/mojo/edk/test/test_support_impl.cc @@ -56,7 +56,8 @@ FILE* TestSupportImpl::OpenSourceRootRelativeFile(const char* relative_path) { char** TestSupportImpl::EnumerateSourceRootRelativeDirectory( const char* relative_path) { std::vector<std::string> names; - base::FileEnumerator e(ResolveSourceRootRelativePath(relative_path), false, + base::FileEnumerator e(ResolveSourceRootRelativePath(relative_path), + false, base::FileEnumerator::FILES); for (base::FilePath name = e.Next(); !name.empty(); name = e.Next()) names.push_back(name.BaseName().AsUTF8Unsafe()); diff --git a/mojo/edk/test/test_support_impl.h b/mojo/edk/test/test_support_impl.h index fce0b4a..8cc9de6 100644 --- a/mojo/edk/test/test_support_impl.h +++ b/mojo/edk/test/test_support_impl.h @@ -20,8 +20,8 @@ class TestSupportImpl : public TestSupport { double value, const char* units) override; virtual FILE* OpenSourceRootRelativeFile(const char* relative_path) override; - virtual char** EnumerateSourceRootRelativeDirectory(const char* relative_path) - override; + virtual char** EnumerateSourceRootRelativeDirectory( + const char* relative_path) override; private: DISALLOW_COPY_AND_ASSIGN(TestSupportImpl); diff --git a/mojo/edk/test/test_utils_win.cc b/mojo/edk/test/test_utils_win.cc index 42613a6..5d5b942 100644 --- a/mojo/edk/test/test_utils_win.cc +++ b/mojo/edk/test/test_utils_win.cc @@ -20,14 +20,17 @@ bool BlockingWrite(const embedder::PlatformHandle& handle, const void* buffer, size_t bytes_to_write, size_t* bytes_written) { - OVERLAPPED overlapped = { 0 }; + OVERLAPPED overlapped = {0}; DWORD bytes_written_dword = 0; - if (!WriteFile(handle.handle, buffer, static_cast<DWORD>(bytes_to_write), - &bytes_written_dword, &overlapped)) { + if (!WriteFile(handle.handle, + buffer, + static_cast<DWORD>(bytes_to_write), + &bytes_written_dword, + &overlapped)) { if (GetLastError() != ERROR_IO_PENDING || - !GetOverlappedResult(handle.handle, &overlapped, &bytes_written_dword, - TRUE)) { + !GetOverlappedResult( + handle.handle, &overlapped, &bytes_written_dword, TRUE)) { return false; } } @@ -40,14 +43,17 @@ bool BlockingRead(const embedder::PlatformHandle& handle, void* buffer, size_t buffer_size, size_t* bytes_read) { - OVERLAPPED overlapped = { 0 }; + OVERLAPPED overlapped = {0}; DWORD bytes_read_dword = 0; - if (!ReadFile(handle.handle, buffer, static_cast<DWORD>(buffer_size), - &bytes_read_dword, &overlapped)) { + if (!ReadFile(handle.handle, + buffer, + static_cast<DWORD>(buffer_size), + &bytes_read_dword, + &overlapped)) { if (GetLastError() != ERROR_IO_PENDING || - !GetOverlappedResult(handle.handle, &overlapped, &bytes_read_dword, - TRUE)) { + !GetOverlappedResult( + handle.handle, &overlapped, &bytes_read_dword, TRUE)) { return false; } } @@ -60,18 +66,21 @@ bool NonBlockingRead(const embedder::PlatformHandle& handle, void* buffer, size_t buffer_size, size_t* bytes_read) { - OVERLAPPED overlapped = { 0 }; + OVERLAPPED overlapped = {0}; DWORD bytes_read_dword = 0; - if (!ReadFile(handle.handle, buffer, static_cast<DWORD>(buffer_size), - &bytes_read_dword, &overlapped)) { + if (!ReadFile(handle.handle, + buffer, + static_cast<DWORD>(buffer_size), + &bytes_read_dword, + &overlapped)) { if (GetLastError() != ERROR_IO_PENDING) return false; CancelIo(handle.handle); - if (!GetOverlappedResult(handle.handle, &overlapped, &bytes_read_dword, - TRUE)) { + if (!GetOverlappedResult( + handle.handle, &overlapped, &bytes_read_dword, TRUE)) { *bytes_read = 0; return true; } @@ -92,7 +101,8 @@ embedder::ScopedPlatformHandle PlatformHandleFromFILE(base::ScopedFILE fp) { &rv, 0, TRUE, - DUPLICATE_SAME_ACCESS)) << "DuplicateHandle"; + DUPLICATE_SAME_ACCESS)) + << "DuplicateHandle"; return embedder::ScopedPlatformHandle(embedder::PlatformHandle(rv)); } @@ -108,10 +118,9 @@ base::ScopedFILE FILEFromPlatformHandle(embedder::ScopedPlatformHandle h, flags |= _O_RDONLY; if (strchr(mode, 't')) flags |= _O_TEXT; - base::ScopedFILE rv( - _fdopen(_open_osfhandle(reinterpret_cast<intptr_t>(h.release().handle), - flags), - mode)); + base::ScopedFILE rv(_fdopen( + _open_osfhandle(reinterpret_cast<intptr_t>(h.release().handle), flags), + mode)); PCHECK(rv) << "_fdopen"; return rv.Pass(); } |