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 <mach/mach.h> | 5 #include <mach/mach.h> |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 // the number of open ports. This is used to protect against leaking Mach ports, | 23 // the number of open ports. This is used to protect against leaking Mach ports, |
24 // which was the source of <http://crbug.com/105513>. | 24 // which was the source of <http://crbug.com/105513>. |
25 class MachPortsTest : public InProcessBrowserTest { | 25 class MachPortsTest : public InProcessBrowserTest { |
26 public: | 26 public: |
27 MachPortsTest() | 27 MachPortsTest() |
28 : server_(net::SpawnedTestServer::TYPE_HTTP, | 28 : server_(net::SpawnedTestServer::TYPE_HTTP, |
29 net::SpawnedTestServer::kLocalhost, | 29 net::SpawnedTestServer::kLocalhost, |
30 base::FilePath(FILE_PATH_LITERAL("data/mach_ports/moz"))) { | 30 base::FilePath(FILE_PATH_LITERAL("data/mach_ports/moz"))) { |
31 } | 31 } |
32 | 32 |
33 virtual void SetUp() OVERRIDE { | 33 virtual void SetUp() override { |
34 InProcessBrowserTest::SetUp(); | 34 InProcessBrowserTest::SetUp(); |
35 | 35 |
36 ASSERT_TRUE(server_.Start()); | 36 ASSERT_TRUE(server_.Start()); |
37 } | 37 } |
38 | 38 |
39 virtual void TearDown() OVERRIDE { | 39 virtual void TearDown() override { |
40 std::string ports; | 40 std::string ports; |
41 for (std::vector<int>::iterator it = port_counts_.begin(); | 41 for (std::vector<int>::iterator it = port_counts_.begin(); |
42 it != port_counts_.end(); ++it) { | 42 it != port_counts_.end(); ++it) { |
43 base::StringAppendF(&ports, "%d,", *it); | 43 base::StringAppendF(&ports, "%d,", *it); |
44 } | 44 } |
45 perf_test::PrintResultList("mach_ports", "", "", ports, "ports", true); | 45 perf_test::PrintResultList("mach_ports", "", "", ports, "ports", true); |
46 | 46 |
47 InProcessBrowserTest::TearDown(); | 47 InProcessBrowserTest::TearDown(); |
48 } | 48 } |
49 | 49 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // Close each tab, recording the number of ports after each. Do not close the | 106 // Close each tab, recording the number of ports after each. Do not close the |
107 // last tab, which is about:blank. | 107 // last tab, which is about:blank. |
108 for (int i = 0; i < tab_count - 1; ++i) { | 108 for (int i = 0; i < tab_count - 1; ++i) { |
109 EXPECT_TRUE( | 109 EXPECT_TRUE( |
110 tab_strip_model->CloseWebContentsAt(0, TabStripModel::CLOSE_NONE)); | 110 tab_strip_model->CloseWebContentsAt(0, TabStripModel::CLOSE_NONE)); |
111 RecordPortCount(); | 111 RecordPortCount(); |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 } // namespace | 115 } // namespace |
OLD | NEW |