| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 vm_deallocate(self, reinterpret_cast<vm_address_t>(names), | 69 vm_deallocate(self, reinterpret_cast<vm_address_t>(names), |
| 70 names_count * sizeof(mach_port_name_array_t)); | 70 names_count * sizeof(mach_port_name_array_t)); |
| 71 vm_deallocate(self, reinterpret_cast<vm_address_t>(types), | 71 vm_deallocate(self, reinterpret_cast<vm_address_t>(types), |
| 72 types_count * sizeof(mach_port_type_array_t)); | 72 types_count * sizeof(mach_port_type_array_t)); |
| 73 } | 73 } |
| 74 | 74 |
| 75 // Adds a tab from the page cycler data at the specified domain. | 75 // Adds a tab from the page cycler data at the specified domain. |
| 76 void AddTab(const std::string& domain) { | 76 void AddTab(const std::string& domain) { |
| 77 GURL url = server_.GetURL("files/" + domain + "/").Resolve("?skip"); | 77 GURL url = server_.GetURL("files/" + domain + "/").Resolve("?skip"); |
| 78 AddTabAtIndex(0, url, content::PageTransition::PAGE_TRANSITION_TYPED); | 78 AddTabAtIndex(0, url, ui::PAGE_TRANSITION_TYPED); |
| 79 } | 79 } |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 net::SpawnedTestServer server_; | 82 net::SpawnedTestServer server_; |
| 83 std::vector<int> port_counts_; | 83 std::vector<int> port_counts_; |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 IN_PROC_BROWSER_TEST_F(MachPortsTest, GetCounts) { | 86 IN_PROC_BROWSER_TEST_F(MachPortsTest, GetCounts) { |
| 87 browser()->window()->Show(); | 87 browser()->window()->Show(); |
| 88 | 88 |
| (...skipping 17 matching lines...) Expand all 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 |