OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/files/file_enumerator.h" | 6 #include "base/files/file_enumerator.h" |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 void RegisterURLLoaderInterceptor( | 84 void RegisterURLLoaderInterceptor( |
85 mojo::URLLoaderInterceptorFactoryPtr factory) override {} | 85 mojo::URLLoaderInterceptorFactoryPtr factory) override {} |
86 void CreateHostResolver( | 86 void CreateHostResolver( |
87 mojo::InterfaceRequest<mojo::HostResolver> host_resolver) override {} | 87 mojo::InterfaceRequest<mojo::HostResolver> host_resolver) override {} |
88 | 88 |
89 MockURLLoader mock_url_loader_; | 89 MockURLLoader mock_url_loader_; |
90 mojo::Binding<mojo::URLLoader> binding_; | 90 mojo::Binding<mojo::URLLoader> binding_; |
91 }; | 91 }; |
92 | 92 |
93 std::string GetDumpContent(const base::FilePath& path) { | 93 std::string GetDumpContent(const base::FilePath& path) { |
94 return "--" + path.value() + "\r\n"; | 94 return "--" + path.BaseName().value() + "\r\n"; |
95 } | 95 } |
96 | 96 |
97 void CreateValidDump(const base::FilePath& path, const base::Time& time) { | 97 void CreateValidDump(const base::FilePath& path, const base::Time& time) { |
98 std::string content = GetDumpContent(path); | 98 std::string content = GetDumpContent(path); |
99 base::WriteFile(path, content.data(), content.size()); | 99 base::WriteFile(path, content.data(), content.size()); |
100 base::TouchFile(path, time, time); | 100 base::TouchFile(path, time, time); |
101 } | 101 } |
102 | 102 |
103 int CountFiles(const base::FilePath& path) { | 103 int CountFiles(const base::FilePath& path) { |
104 base::FileEnumerator files(path, false, base::FileEnumerator::FILES); | 104 base::FileEnumerator files(path, false, base::FileEnumerator::FILES); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 201 |
202 EXPECT_TRUE(mock_network_service_.url_loader()->called()); | 202 EXPECT_TRUE(mock_network_service_.url_loader()->called()); |
203 EXPECT_TRUE(base::PathExists(GetSentinelPath(dumps_dir_.path()))); | 203 EXPECT_TRUE(base::PathExists(GetSentinelPath(dumps_dir_.path()))); |
204 EXPECT_EQ(GetDumpContent(dumps_dir_.path().Append("0.dmp")), | 204 EXPECT_EQ(GetDumpContent(dumps_dir_.path().Append("0.dmp")), |
205 mock_network_service_.url_loader()->GetLastContent()); | 205 mock_network_service_.url_loader()->GetLastContent()); |
206 EXPECT_EQ(1, CountFiles(dumps_dir_.path())); | 206 EXPECT_EQ(1, CountFiles(dumps_dir_.path())); |
207 } | 207 } |
208 | 208 |
209 } // namespace | 209 } // namespace |
210 } // namespace breakpad | 210 } // namespace breakpad |
OLD | NEW |