| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/site_details.h" | 5 #include "chrome/browser/site_details.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 namespace { | 52 namespace { |
| 53 | 53 |
| 54 class TestMemoryDetails : public MetricsMemoryDetails { | 54 class TestMemoryDetails : public MetricsMemoryDetails { |
| 55 public: | 55 public: |
| 56 TestMemoryDetails() | 56 TestMemoryDetails() |
| 57 : MetricsMemoryDetails(base::Bind(&base::DoNothing), nullptr) {} | 57 : MetricsMemoryDetails(base::Bind(&base::DoNothing), nullptr) {} |
| 58 | 58 |
| 59 void StartFetchAndWait() { | 59 void StartFetchAndWait() { |
| 60 uma_.reset(new base::HistogramTester()); | 60 uma_.reset(new base::HistogramTester()); |
| 61 StartFetch(FROM_CHROME_ONLY); | 61 StartFetch(); |
| 62 content::RunMessageLoop(); | 62 content::RunMessageLoop(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 // Returns a HistogramTester which observed the most recent call to | 65 // Returns a HistogramTester which observed the most recent call to |
| 66 // StartFetchAndWait(). | 66 // StartFetchAndWait(). |
| 67 base::HistogramTester* uma() { return uma_.get(); } | 67 base::HistogramTester* uma() { return uma_.get(); } |
| 68 | 68 |
| 69 int GetOutOfProcessIframeCount() { | 69 int GetOutOfProcessIframeCount() { |
| 70 std::vector<Bucket> buckets = | 70 std::vector<Bucket> buckets = |
| 71 uma_->GetAllSamples("SiteIsolation.OutOfProcessIframes"); | 71 uma_->GetAllSamples("SiteIsolation.OutOfProcessIframes"); |
| (...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1230 content::NavigateIframeToURL( | 1230 content::NavigateIframeToURL( |
| 1231 tab, "child-1", extension2->GetResourceURL("/blank_iframe.html")); | 1231 tab, "child-1", extension2->GetResourceURL("/blank_iframe.html")); |
| 1232 details = new TestMemoryDetails(); | 1232 details = new TestMemoryDetails(); |
| 1233 details->StartFetchAndWait(); | 1233 details->StartFetchAndWait(); |
| 1234 EXPECT_THAT(details->uma()->GetAllSamples( | 1234 EXPECT_THAT(details->uma()->GetAllSamples( |
| 1235 "SiteIsolation.SiteInstancesPerBrowsingInstance"), | 1235 "SiteIsolation.SiteInstancesPerBrowsingInstance"), |
| 1236 DependingOnPolicy(ElementsAre(Bucket(1, 2)), | 1236 DependingOnPolicy(ElementsAre(Bucket(1, 2)), |
| 1237 ElementsAre(Bucket(1, 1), Bucket(3, 1)), | 1237 ElementsAre(Bucket(1, 1), Bucket(3, 1)), |
| 1238 ElementsAre(Bucket(1, 1), Bucket(5, 1)))); | 1238 ElementsAre(Bucket(1, 1), Bucket(5, 1)))); |
| 1239 } | 1239 } |
| OLD | NEW |