| OLD | NEW |
| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 class LogPrivateApiTest : public ExtensionApiTest { | 65 class LogPrivateApiTest : public ExtensionApiTest { |
| 66 public: | 66 public: |
| 67 LogPrivateApiTest() {} | 67 LogPrivateApiTest() {} |
| 68 | 68 |
| 69 ~LogPrivateApiTest() override {} | 69 ~LogPrivateApiTest() override {} |
| 70 | 70 |
| 71 void SetUpInProcessBrowserTestFixture() override { | 71 void SetUpInProcessBrowserTestFixture() override { |
| 72 base::FilePath tar_file_path = | 72 base::FilePath tar_file_path = |
| 73 test_data_dir_.Append("log_private/dump_logs/system_logs.tar"); | 73 test_data_dir_.Append("log_private/dump_logs/system_logs.tar"); |
| 74 chromeos::DBusThreadManager::GetSetterForTesting()->SetDebugDaemonClient( | 74 chromeos::DBusThreadManager::GetSetterForTesting()->SetDebugDaemonClient( |
| 75 scoped_ptr<chromeos::DebugDaemonClient>( | 75 std::unique_ptr<chromeos::DebugDaemonClient>( |
| 76 new TestDebugDaemonClient(tar_file_path))); | 76 new TestDebugDaemonClient(tar_file_path))); |
| 77 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); | 77 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 scoped_ptr<HttpResponse> HandleRequest(const HttpRequest& request) { | 80 std::unique_ptr<HttpResponse> HandleRequest(const HttpRequest& request) { |
| 81 scoped_ptr<BasicHttpResponse> response(new BasicHttpResponse); | 81 std::unique_ptr<BasicHttpResponse> response(new BasicHttpResponse); |
| 82 response->set_code(net::HTTP_OK); | 82 response->set_code(net::HTTP_OK); |
| 83 response->set_content( | 83 response->set_content( |
| 84 "<html><head><title>LogPrivateTest</title>" | 84 "<html><head><title>LogPrivateTest</title>" |
| 85 "</head><body>Hello!</body></html>"); | 85 "</head><body>Hello!</body></html>"); |
| 86 return std::move(response); | 86 return std::move(response); |
| 87 } | 87 } |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 IN_PROC_BROWSER_TEST_F(LogPrivateApiTest, DumpLogsAndCaptureEvents) { | 90 IN_PROC_BROWSER_TEST_F(LogPrivateApiTest, DumpLogsAndCaptureEvents) { |
| 91 // Setup dummy HTTP server. | 91 // Setup dummy HTTP server. |
| 92 host_resolver()->AddRule("www.test.com", "127.0.0.1"); | 92 host_resolver()->AddRule("www.test.com", "127.0.0.1"); |
| 93 ASSERT_TRUE(StartEmbeddedTestServer()); | 93 ASSERT_TRUE(StartEmbeddedTestServer()); |
| 94 embedded_test_server()->RegisterRequestHandler( | 94 embedded_test_server()->RegisterRequestHandler( |
| 95 base::Bind(&LogPrivateApiTest::HandleRequest, base::Unretained(this))); | 95 base::Bind(&LogPrivateApiTest::HandleRequest, base::Unretained(this))); |
| 96 | 96 |
| 97 ASSERT_TRUE(RunExtensionTest("log_private/dump_logs")); | 97 ASSERT_TRUE(RunExtensionTest("log_private/dump_logs")); |
| 98 } | 98 } |
| 99 | 99 |
| 100 } // namespace extensions | 100 } // namespace extensions |
| OLD | NEW |