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 "base/task_scheduler/post_task.h" | 10 #include "base/task_scheduler/post_task.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 std::unique_ptr<chromeos::DebugDaemonClient>( | 75 std::unique_ptr<chromeos::DebugDaemonClient>( |
76 new TestDebugDaemonClient(tar_file_path))); | 76 new TestDebugDaemonClient(tar_file_path))); |
| 77 host_resolver()->AddRule("www.test.com", "127.0.0.1"); |
77 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); | 78 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); |
78 } | 79 } |
79 | 80 |
80 std::unique_ptr<HttpResponse> HandleRequest(const HttpRequest& request) { | 81 std::unique_ptr<HttpResponse> HandleRequest(const HttpRequest& request) { |
81 std::unique_ptr<BasicHttpResponse> response(new BasicHttpResponse); | 82 std::unique_ptr<BasicHttpResponse> response(new BasicHttpResponse); |
82 response->set_code(net::HTTP_OK); | 83 response->set_code(net::HTTP_OK); |
83 response->set_content( | 84 response->set_content( |
84 "<html><head><title>LogPrivateTest</title>" | 85 "<html><head><title>LogPrivateTest</title>" |
85 "</head><body>Hello!</body></html>"); | 86 "</head><body>Hello!</body></html>"); |
86 return std::move(response); | 87 return std::move(response); |
87 } | 88 } |
88 }; | 89 }; |
89 | 90 |
90 IN_PROC_BROWSER_TEST_F(LogPrivateApiTest, DumpLogsAndCaptureEvents) { | 91 IN_PROC_BROWSER_TEST_F(LogPrivateApiTest, DumpLogsAndCaptureEvents) { |
91 // Setup dummy HTTP server. | 92 // Setup dummy HTTP server. |
92 host_resolver()->AddRule("www.test.com", "127.0.0.1"); | |
93 embedded_test_server()->RegisterRequestHandler( | 93 embedded_test_server()->RegisterRequestHandler( |
94 base::Bind(&LogPrivateApiTest::HandleRequest, base::Unretained(this))); | 94 base::Bind(&LogPrivateApiTest::HandleRequest, base::Unretained(this))); |
95 ASSERT_TRUE(StartEmbeddedTestServer()); | 95 ASSERT_TRUE(StartEmbeddedTestServer()); |
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 |