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

Side by Side Diff: chrome/browser/extensions/api/log_private/log_private_apitest_chromeos.cc

Issue 2081153002: No dbus::FileDescriptor in DebugDaemonClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments 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
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 <string> 5 #include <string>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "chrome/browser/extensions/extension_apitest.h" 10 #include "chrome/browser/extensions/extension_apitest.h"
(...skipping 14 matching lines...) Expand all
25 namespace { 25 namespace {
26 26
27 class TestDebugDaemonClient : public chromeos::FakeDebugDaemonClient { 27 class TestDebugDaemonClient : public chromeos::FakeDebugDaemonClient {
28 public: 28 public:
29 explicit TestDebugDaemonClient(const base::FilePath& test_file) 29 explicit TestDebugDaemonClient(const base::FilePath& test_file)
30 : test_file_(test_file) {} 30 : test_file_(test_file) {}
31 31
32 ~TestDebugDaemonClient() override {} 32 ~TestDebugDaemonClient() override {}
33 33
34 void DumpDebugLogs(bool is_compressed, 34 void DumpDebugLogs(bool is_compressed,
35 base::File file, 35 int file_descriptor,
36 scoped_refptr<base::TaskRunner> task_runner,
37 const GetDebugLogsCallback& callback) override { 36 const GetDebugLogsCallback& callback) override {
38 base::File* file_param = new base::File(std::move(file)); 37 base::File* file_param = new base::File(dup(file_descriptor));
satorux1 2016/08/23 07:02:02 I think it's not so obvious why dup() is needed he
hashimoto 2016/08/23 07:41:27 Done.
39 task_runner->PostTaskAndReply( 38 content::BrowserThread::PostBlockingPoolTaskAndReply(
40 FROM_HERE, 39 FROM_HERE, base::Bind(&GenerateTestLogDumpFile, test_file_,
41 base::Bind( 40 base::Owned(file_param)),
42 &GenerateTestLogDumpFile, test_file_, base::Owned(file_param)),
43 base::Bind(callback, true)); 41 base::Bind(callback, true));
44 } 42 }
45 43
46 static void GenerateTestLogDumpFile(const base::FilePath& test_tar_file, 44 static void GenerateTestLogDumpFile(const base::FilePath& test_tar_file,
47 base::File* file) { 45 base::File* file) {
48 std::string test_file_content; 46 std::string test_file_content;
49 EXPECT_TRUE(base::ReadFileToString(test_tar_file, &test_file_content)) 47 EXPECT_TRUE(base::ReadFileToString(test_tar_file, &test_file_content))
50 << "Cannot read content of file " << test_tar_file.value(); 48 << "Cannot read content of file " << test_tar_file.value();
51 const int data_size = static_cast<int>(test_file_content.size()); 49 const int data_size = static_cast<int>(test_file_content.size());
52 EXPECT_EQ(data_size, file->Write(0, test_file_content.data(), data_size)); 50 EXPECT_EQ(data_size, file->Write(0, test_file_content.data(), data_size));
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // Setup dummy HTTP server. 89 // Setup dummy HTTP server.
92 host_resolver()->AddRule("www.test.com", "127.0.0.1"); 90 host_resolver()->AddRule("www.test.com", "127.0.0.1");
93 ASSERT_TRUE(StartEmbeddedTestServer()); 91 ASSERT_TRUE(StartEmbeddedTestServer());
94 embedded_test_server()->RegisterRequestHandler( 92 embedded_test_server()->RegisterRequestHandler(
95 base::Bind(&LogPrivateApiTest::HandleRequest, base::Unretained(this))); 93 base::Bind(&LogPrivateApiTest::HandleRequest, base::Unretained(this)));
96 94
97 ASSERT_TRUE(RunExtensionTest("log_private/dump_logs")); 95 ASSERT_TRUE(RunExtensionTest("log_private/dump_logs"));
98 } 96 }
99 97
100 } // namespace extensions 98 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/system_logs/debug_log_writer.cc ('k') | chrome/browser/metrics/perf/perf_output.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698