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 "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 void StartFetchAndWait() { | 48 void StartFetchAndWait() { |
49 uma_.reset(new base::HistogramTester()); | 49 uma_.reset(new base::HistogramTester()); |
50 StartFetch(FROM_CHROME_ONLY); | 50 StartFetch(FROM_CHROME_ONLY); |
51 content::RunMessageLoop(); | 51 content::RunMessageLoop(); |
52 } | 52 } |
53 | 53 |
54 // Returns a HistogramTester which observed the most recent call to | 54 // Returns a HistogramTester which observed the most recent call to |
55 // StartFetchAndWait(). | 55 // StartFetchAndWait(). |
56 base::HistogramTester* uma() { return uma_.get(); } | 56 base::HistogramTester* uma() { return uma_.get(); } |
57 | 57 |
| 58 int CountPageTitles() { |
| 59 size_t count = 0; |
| 60 for (const ProcessMemoryInformation& process : ChromeBrowser()->processes) { |
| 61 if (process.process_type == content::PROCESS_TYPE_RENDERER) { |
| 62 count += process.titles.size(); |
| 63 } |
| 64 } |
| 65 return static_cast<int>(count); |
| 66 } |
| 67 |
58 private: | 68 private: |
59 ~TestMemoryDetails() override {} | 69 ~TestMemoryDetails() override {} |
60 | 70 |
61 void OnDetailsAvailable() override { | 71 void OnDetailsAvailable() override { |
62 MetricsMemoryDetails::OnDetailsAvailable(); | 72 MetricsMemoryDetails::OnDetailsAvailable(); |
63 // Exit the loop initiated by StartFetchAndWait(). | 73 // Exit the loop initiated by StartFetchAndWait(). |
64 base::MessageLoop::current()->Quit(); | 74 base::MessageLoop::current()->Quit(); |
65 } | 75 } |
66 | 76 |
67 scoped_ptr<base::HistogramTester> uma_; | 77 scoped_ptr<base::HistogramTester> uma_; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // None of these are https. | 210 // None of these are https. |
201 GURL abcdefghi_url = embedded_test_server()->GetURL( | 211 GURL abcdefghi_url = embedded_test_server()->GetURL( |
202 "a.com", | 212 "a.com", |
203 "/cross_site_iframe_factory.html?a(b(a(b,c,d,e,f,g,h)),c,d,e,i(f))"); | 213 "/cross_site_iframe_factory.html?a(b(a(b,c,d,e,f,g,h)),c,d,e,i(f))"); |
204 ui_test_utils::NavigateToURL(browser(), abcdefghi_url); | 214 ui_test_utils::NavigateToURL(browser(), abcdefghi_url); |
205 | 215 |
206 // Get the metrics. | 216 // Get the metrics. |
207 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails(); | 217 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails(); |
208 details->StartFetchAndWait(); | 218 details->StartFetchAndWait(); |
209 | 219 |
| 220 EXPECT_EQ(1, details->CountPageTitles()); |
210 EXPECT_THAT( | 221 EXPECT_THAT( |
211 details->uma()->GetAllSamples("SiteIsolation.BrowsingInstanceCount"), | 222 details->uma()->GetAllSamples("SiteIsolation.BrowsingInstanceCount"), |
212 ElementsAre(Bucket(1, 1))); | 223 ElementsAre(Bucket(1, 1))); |
213 EXPECT_THAT(details->uma()->GetAllSamples( | 224 EXPECT_THAT(details->uma()->GetAllSamples( |
214 "SiteIsolation.CurrentRendererProcessCount"), | 225 "SiteIsolation.CurrentRendererProcessCount"), |
| 226 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 227 EXPECT_THAT(details->uma()->GetAllSamples( |
| 228 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
215 ElementsAre(Bucket(1, 1))); | 229 ElementsAre(Bucket(1, 1))); |
216 EXPECT_THAT(details->uma()->GetAllSamples( | 230 EXPECT_THAT(details->uma()->GetAllSamples( |
217 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), | 231 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), |
218 ElementsAre(Bucket(9, 1))); | 232 ElementsAre(Bucket(9, 1))); |
219 EXPECT_THAT(details->uma()->GetAllSamples( | 233 EXPECT_THAT(details->uma()->GetAllSamples( |
220 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), | 234 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), |
221 ElementsAre(Bucket(9, 1))); | 235 ElementsAre(Bucket(9, 1))); |
222 EXPECT_THAT(details->uma()->GetAllSamples( | 236 EXPECT_THAT(details->uma()->GetAllSamples( |
223 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), | 237 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), |
224 ElementsAre(Bucket(9, 1))); | 238 ElementsAre(Bucket(9, 1))); |
(...skipping 20 matching lines...) Expand all Loading... |
245 | 259 |
246 // Navigate to a different, disjoint set of 7 sites. | 260 // Navigate to a different, disjoint set of 7 sites. |
247 GURL pqrstuv_url = embedded_test_server()->GetURL( | 261 GURL pqrstuv_url = embedded_test_server()->GetURL( |
248 "p.com", | 262 "p.com", |
249 "/cross_site_iframe_factory.html?p(q(r),r(s),s(t),t(q),u(u),v(p))"); | 263 "/cross_site_iframe_factory.html?p(q(r),r(s),s(t),t(q),u(u),v(p))"); |
250 ui_test_utils::NavigateToURL(browser(), pqrstuv_url); | 264 ui_test_utils::NavigateToURL(browser(), pqrstuv_url); |
251 | 265 |
252 details = new TestMemoryDetails(); | 266 details = new TestMemoryDetails(); |
253 details->StartFetchAndWait(); | 267 details->StartFetchAndWait(); |
254 | 268 |
| 269 EXPECT_EQ(1, details->CountPageTitles()); |
255 EXPECT_THAT( | 270 EXPECT_THAT( |
256 details->uma()->GetAllSamples("SiteIsolation.BrowsingInstanceCount"), | 271 details->uma()->GetAllSamples("SiteIsolation.BrowsingInstanceCount"), |
257 ElementsAre(Bucket(1, 1))); | 272 ElementsAre(Bucket(1, 1))); |
258 EXPECT_THAT(details->uma()->GetAllSamples( | 273 EXPECT_THAT(details->uma()->GetAllSamples( |
259 "SiteIsolation.CurrentRendererProcessCount"), | 274 "SiteIsolation.CurrentRendererProcessCount"), |
| 275 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 276 EXPECT_THAT(details->uma()->GetAllSamples( |
| 277 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
260 ElementsAre(Bucket(1, 1))); | 278 ElementsAre(Bucket(1, 1))); |
261 EXPECT_THAT(details->uma()->GetAllSamples( | 279 EXPECT_THAT(details->uma()->GetAllSamples( |
262 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), | 280 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), |
263 ElementsAre(Bucket(7, 1))); | 281 ElementsAre(Bucket(7, 1))); |
264 EXPECT_THAT(details->uma()->GetAllSamples( | 282 EXPECT_THAT(details->uma()->GetAllSamples( |
265 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), | 283 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), |
266 ElementsAre(Bucket(7, 1))); | 284 ElementsAre(Bucket(7, 1))); |
267 EXPECT_THAT(details->uma()->GetAllSamples( | 285 EXPECT_THAT(details->uma()->GetAllSamples( |
268 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), | 286 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), |
269 ElementsAre(Bucket(7, 1))); | 287 ElementsAre(Bucket(7, 1))); |
(...skipping 19 matching lines...) Expand all Loading... |
289 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(7)); | 307 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(7)); |
290 | 308 |
291 // Open a second tab (different BrowsingInstance) with 4 sites (a through d). | 309 // Open a second tab (different BrowsingInstance) with 4 sites (a through d). |
292 GURL abcd_url = embedded_test_server()->GetURL( | 310 GURL abcd_url = embedded_test_server()->GetURL( |
293 "a.com", "/cross_site_iframe_factory.html?a(b(c(d())))"); | 311 "a.com", "/cross_site_iframe_factory.html?a(b(c(d())))"); |
294 AddTabAtIndex(1, abcd_url, ui::PAGE_TRANSITION_TYPED); | 312 AddTabAtIndex(1, abcd_url, ui::PAGE_TRANSITION_TYPED); |
295 | 313 |
296 details = new TestMemoryDetails(); | 314 details = new TestMemoryDetails(); |
297 details->StartFetchAndWait(); | 315 details->StartFetchAndWait(); |
298 | 316 |
| 317 EXPECT_EQ(2, details->CountPageTitles()); |
299 EXPECT_THAT( | 318 EXPECT_THAT( |
300 details->uma()->GetAllSamples("SiteIsolation.BrowsingInstanceCount"), | 319 details->uma()->GetAllSamples("SiteIsolation.BrowsingInstanceCount"), |
301 ElementsAre(Bucket(2, 1))); | 320 ElementsAre(Bucket(2, 1))); |
302 EXPECT_THAT(details->uma()->GetAllSamples( | 321 EXPECT_THAT(details->uma()->GetAllSamples( |
303 "SiteIsolation.CurrentRendererProcessCount"), | 322 "SiteIsolation.CurrentRendererProcessCount"), |
| 323 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 324 EXPECT_THAT(details->uma()->GetAllSamples( |
| 325 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
304 ElementsAre(Bucket(2, 1))); | 326 ElementsAre(Bucket(2, 1))); |
305 EXPECT_THAT(details->uma()->GetAllSamples( | 327 EXPECT_THAT(details->uma()->GetAllSamples( |
306 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), | 328 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), |
307 ElementsAre(Bucket(11, 1))); | 329 ElementsAre(Bucket(11, 1))); |
308 EXPECT_THAT(details->uma()->GetAllSamples( | 330 EXPECT_THAT(details->uma()->GetAllSamples( |
309 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), | 331 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), |
310 ElementsAre(Bucket(11, 1))); | 332 ElementsAre(Bucket(11, 1))); |
311 EXPECT_THAT(details->uma()->GetAllSamples( | 333 EXPECT_THAT(details->uma()->GetAllSamples( |
312 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), | 334 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), |
313 ElementsAre(Bucket(11, 1))); | 335 ElementsAre(Bucket(11, 1))); |
(...skipping 22 matching lines...) Expand all Loading... |
336 AddTabAtIndex(2, abcd_url, ui::PAGE_TRANSITION_TYPED); | 358 AddTabAtIndex(2, abcd_url, ui::PAGE_TRANSITION_TYPED); |
337 | 359 |
338 details = new TestMemoryDetails(); | 360 details = new TestMemoryDetails(); |
339 details->StartFetchAndWait(); | 361 details->StartFetchAndWait(); |
340 | 362 |
341 EXPECT_THAT( | 363 EXPECT_THAT( |
342 details->uma()->GetAllSamples("SiteIsolation.BrowsingInstanceCount"), | 364 details->uma()->GetAllSamples("SiteIsolation.BrowsingInstanceCount"), |
343 ElementsAre(Bucket(3, 1))); | 365 ElementsAre(Bucket(3, 1))); |
344 EXPECT_THAT(details->uma()->GetAllSamples( | 366 EXPECT_THAT(details->uma()->GetAllSamples( |
345 "SiteIsolation.CurrentRendererProcessCount"), | 367 "SiteIsolation.CurrentRendererProcessCount"), |
| 368 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 369 EXPECT_THAT(details->uma()->GetAllSamples( |
| 370 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
346 ElementsAre(Bucket(3, 1))); | 371 ElementsAre(Bucket(3, 1))); |
347 // Could be 11 if subframe processes were reused across BrowsingInstances. | 372 // Could be 11 if subframe processes were reused across BrowsingInstances. |
348 EXPECT_THAT(details->uma()->GetAllSamples( | 373 EXPECT_THAT(details->uma()->GetAllSamples( |
349 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), | 374 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), |
350 ElementsAre(Bucket(15, 1))); | 375 ElementsAre(Bucket(15, 1))); |
351 EXPECT_THAT(details->uma()->GetAllSamples( | 376 EXPECT_THAT(details->uma()->GetAllSamples( |
352 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), | 377 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), |
353 ElementsAre(Bucket(11, 1))); | 378 ElementsAre(Bucket(11, 1))); |
354 EXPECT_THAT(details->uma()->GetAllSamples( | 379 EXPECT_THAT(details->uma()->GetAllSamples( |
355 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), | 380 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 load_complete.Wait(); | 417 load_complete.Wait(); |
393 | 418 |
394 details = new TestMemoryDetails(); | 419 details = new TestMemoryDetails(); |
395 details->StartFetchAndWait(); | 420 details->StartFetchAndWait(); |
396 | 421 |
397 EXPECT_THAT( | 422 EXPECT_THAT( |
398 details->uma()->GetAllSamples("SiteIsolation.BrowsingInstanceCount"), | 423 details->uma()->GetAllSamples("SiteIsolation.BrowsingInstanceCount"), |
399 ElementsAre(Bucket(3, 1))); | 424 ElementsAre(Bucket(3, 1))); |
400 EXPECT_THAT(details->uma()->GetAllSamples( | 425 EXPECT_THAT(details->uma()->GetAllSamples( |
401 "SiteIsolation.CurrentRendererProcessCount"), | 426 "SiteIsolation.CurrentRendererProcessCount"), |
| 427 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 428 EXPECT_THAT(details->uma()->GetAllSamples( |
| 429 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
402 ElementsAre(Bucket(3, 1))); | 430 ElementsAre(Bucket(3, 1))); |
403 // Could be 11 if subframe processes were reused across BrowsingInstances. | 431 // Could be 11 if subframe processes were reused across BrowsingInstances. |
404 EXPECT_THAT(details->uma()->GetAllSamples( | 432 EXPECT_THAT(details->uma()->GetAllSamples( |
405 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), | 433 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), |
406 ElementsAre(Bucket(16, 1))); | 434 ElementsAre(Bucket(16, 1))); |
407 EXPECT_THAT(details->uma()->GetAllSamples( | 435 EXPECT_THAT(details->uma()->GetAllSamples( |
408 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), | 436 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), |
409 ElementsAre(Bucket(12, 1))); | 437 ElementsAre(Bucket(12, 1))); |
410 EXPECT_THAT(details->uma()->GetAllSamples( | 438 EXPECT_THAT(details->uma()->GetAllSamples( |
411 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), | 439 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), |
(...skipping 20 matching lines...) Expand all Loading... |
432 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(16)); | 460 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(16)); |
433 } | 461 } |
434 | 462 |
435 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) { | 463 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) { |
436 // We start on "about:blank", which should be credited with a process in this | 464 // We start on "about:blank", which should be credited with a process in this |
437 // case. | 465 // case. |
438 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails(); | 466 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails(); |
439 details->StartFetchAndWait(); | 467 details->StartFetchAndWait(); |
440 EXPECT_THAT(details->uma()->GetAllSamples( | 468 EXPECT_THAT(details->uma()->GetAllSamples( |
441 "SiteIsolation.CurrentRendererProcessCount"), | 469 "SiteIsolation.CurrentRendererProcessCount"), |
| 470 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 471 EXPECT_THAT(details->uma()->GetAllSamples( |
| 472 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
442 ElementsAre(Bucket(1, 1))); | 473 ElementsAre(Bucket(1, 1))); |
443 EXPECT_THAT(details->uma()->GetAllSamples( | 474 EXPECT_THAT(details->uma()->GetAllSamples( |
444 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 475 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
445 ElementsAre(Bucket(1, 1))); | 476 ElementsAre(Bucket(1, 1))); |
446 EXPECT_THAT(details->uma()->GetAllSamples( | 477 EXPECT_THAT(details->uma()->GetAllSamples( |
447 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 478 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
448 ElementsAre(Bucket(1, 1))); | 479 ElementsAre(Bucket(1, 1))); |
449 EXPECT_THAT(details->uma()->GetAllSamples( | 480 EXPECT_THAT(details->uma()->GetAllSamples( |
450 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 481 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
451 ElementsAre(Bucket(1, 1))); | 482 ElementsAre(Bucket(1, 1))); |
(...skipping 13 matching lines...) Expand all Loading... |
465 WebContents* tab1 = browser()->tab_strip_model()->GetWebContentsAt(0); | 496 WebContents* tab1 = browser()->tab_strip_model()->GetWebContentsAt(0); |
466 GURL tab2_url = embedded_test_server()->GetURL( | 497 GURL tab2_url = embedded_test_server()->GetURL( |
467 "a.com", "/cross_site_iframe_factory.html?a(d,e)"); | 498 "a.com", "/cross_site_iframe_factory.html?a(d,e)"); |
468 AddTabAtIndex(1, tab2_url, ui::PAGE_TRANSITION_TYPED); | 499 AddTabAtIndex(1, tab2_url, ui::PAGE_TRANSITION_TYPED); |
469 WebContents* tab2 = browser()->tab_strip_model()->GetWebContentsAt(1); | 500 WebContents* tab2 = browser()->tab_strip_model()->GetWebContentsAt(1); |
470 | 501 |
471 details = new TestMemoryDetails(); | 502 details = new TestMemoryDetails(); |
472 details->StartFetchAndWait(); | 503 details->StartFetchAndWait(); |
473 EXPECT_THAT(details->uma()->GetAllSamples( | 504 EXPECT_THAT(details->uma()->GetAllSamples( |
474 "SiteIsolation.CurrentRendererProcessCount"), | 505 "SiteIsolation.CurrentRendererProcessCount"), |
| 506 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 507 EXPECT_THAT(details->uma()->GetAllSamples( |
| 508 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
475 ElementsAre(Bucket(3, 1))); | 509 ElementsAre(Bucket(3, 1))); |
476 EXPECT_THAT(details->uma()->GetAllSamples( | 510 EXPECT_THAT(details->uma()->GetAllSamples( |
477 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 511 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
478 ElementsAre(Bucket(3, 1))); | 512 ElementsAre(Bucket(3, 1))); |
479 EXPECT_THAT(details->uma()->GetAllSamples( | 513 EXPECT_THAT(details->uma()->GetAllSamples( |
480 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 514 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
481 ElementsAre(Bucket(2, 1))); | 515 ElementsAre(Bucket(2, 1))); |
482 EXPECT_THAT(details->uma()->GetAllSamples( | 516 EXPECT_THAT(details->uma()->GetAllSamples( |
483 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 517 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
484 ElementsAre(Bucket(3, 1))); | 518 ElementsAre(Bucket(3, 1))); |
485 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); | 519 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); |
486 | 520 |
487 // Test that "one process per extension" applies even when web content has an | 521 // Test that "one process per extension" applies even when web content has an |
488 // extension iframe. | 522 // extension iframe. |
489 | 523 |
490 // Tab1 navigates its first iframe to a resource of extension1. This shouldn't | 524 // Tab1 navigates its first iframe to a resource of extension1. This shouldn't |
491 // result in a new extension process (it should share with extension1's | 525 // result in a new extension process (it should share with extension1's |
492 // background page). | 526 // background page). |
493 content::NavigateIframeToURL( | 527 content::NavigateIframeToURL( |
494 tab1, "child-0", extension1->GetResourceURL("/blank_iframe.html")); | 528 tab1, "child-0", extension1->GetResourceURL("/blank_iframe.html")); |
495 details = new TestMemoryDetails(); | 529 details = new TestMemoryDetails(); |
496 details->StartFetchAndWait(); | 530 details->StartFetchAndWait(); |
497 EXPECT_THAT(details->uma()->GetAllSamples( | 531 EXPECT_THAT(details->uma()->GetAllSamples( |
498 "SiteIsolation.CurrentRendererProcessCount"), | 532 "SiteIsolation.CurrentRendererProcessCount"), |
| 533 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 534 EXPECT_THAT(details->uma()->GetAllSamples( |
| 535 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
499 ElementsAre(Bucket(3, 1))); | 536 ElementsAre(Bucket(3, 1))); |
500 EXPECT_THAT(details->uma()->GetAllSamples( | 537 EXPECT_THAT(details->uma()->GetAllSamples( |
501 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 538 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
502 ElementsAre(Bucket(3, 1))); | 539 ElementsAre(Bucket(3, 1))); |
503 EXPECT_THAT(details->uma()->GetAllSamples( | 540 EXPECT_THAT(details->uma()->GetAllSamples( |
504 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 541 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
505 ElementsAre(Bucket(2, 1))); | 542 ElementsAre(Bucket(2, 1))); |
506 EXPECT_THAT(details->uma()->GetAllSamples( | 543 EXPECT_THAT(details->uma()->GetAllSamples( |
507 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 544 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
508 ElementsAre(Bucket(3, 1))); | 545 ElementsAre(Bucket(3, 1))); |
509 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); | 546 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); |
510 | 547 |
511 // Tab2 navigates its first iframe to a resource of extension1. This also | 548 // Tab2 navigates its first iframe to a resource of extension1. This also |
512 // shouldn't result in a new extension process (it should share with the | 549 // shouldn't result in a new extension process (it should share with the |
513 // background page and the other iframe). | 550 // background page and the other iframe). |
514 content::NavigateIframeToURL( | 551 content::NavigateIframeToURL( |
515 tab2, "child-0", extension1->GetResourceURL("/blank_iframe.html")); | 552 tab2, "child-0", extension1->GetResourceURL("/blank_iframe.html")); |
516 details = new TestMemoryDetails(); | 553 details = new TestMemoryDetails(); |
517 details->StartFetchAndWait(); | 554 details->StartFetchAndWait(); |
518 EXPECT_THAT(details->uma()->GetAllSamples( | 555 EXPECT_THAT(details->uma()->GetAllSamples( |
519 "SiteIsolation.CurrentRendererProcessCount"), | 556 "SiteIsolation.CurrentRendererProcessCount"), |
| 557 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 558 EXPECT_THAT(details->uma()->GetAllSamples( |
| 559 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
520 ElementsAre(Bucket(3, 1))); | 560 ElementsAre(Bucket(3, 1))); |
521 EXPECT_THAT(details->uma()->GetAllSamples( | 561 EXPECT_THAT(details->uma()->GetAllSamples( |
522 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 562 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
523 ElementsAre(Bucket(3, 1))); | 563 ElementsAre(Bucket(3, 1))); |
524 EXPECT_THAT(details->uma()->GetAllSamples( | 564 EXPECT_THAT(details->uma()->GetAllSamples( |
525 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 565 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
526 ElementsAre(Bucket(2, 1))); | 566 ElementsAre(Bucket(2, 1))); |
527 EXPECT_THAT(details->uma()->GetAllSamples( | 567 EXPECT_THAT(details->uma()->GetAllSamples( |
528 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 568 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
529 ElementsAre(Bucket(3, 1))); | 569 ElementsAre(Bucket(3, 1))); |
530 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); | 570 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); |
531 | 571 |
532 // Tab1 navigates its second iframe to a resource of extension2. This SHOULD | 572 // Tab1 navigates its second iframe to a resource of extension2. This SHOULD |
533 // result in a new process since extension2 had no existing process. | 573 // result in a new process since extension2 had no existing process. |
534 content::NavigateIframeToURL( | 574 content::NavigateIframeToURL( |
535 tab1, "child-1", extension2->GetResourceURL("/blank_iframe.html")); | 575 tab1, "child-1", extension2->GetResourceURL("/blank_iframe.html")); |
536 details = new TestMemoryDetails(); | 576 details = new TestMemoryDetails(); |
537 details->StartFetchAndWait(); | 577 details->StartFetchAndWait(); |
538 EXPECT_THAT(details->uma()->GetAllSamples( | 578 EXPECT_THAT(details->uma()->GetAllSamples( |
539 "SiteIsolation.CurrentRendererProcessCount"), | 579 "SiteIsolation.CurrentRendererProcessCount"), |
| 580 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 581 EXPECT_THAT(details->uma()->GetAllSamples( |
| 582 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
540 ElementsAre(Bucket(3, 1))); | 583 ElementsAre(Bucket(3, 1))); |
541 EXPECT_THAT(details->uma()->GetAllSamples( | 584 EXPECT_THAT(details->uma()->GetAllSamples( |
542 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 585 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
543 ElementsAre(Bucket(4, 1))); | 586 ElementsAre(Bucket(4, 1))); |
544 EXPECT_THAT(details->uma()->GetAllSamples( | 587 EXPECT_THAT(details->uma()->GetAllSamples( |
545 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 588 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
546 ElementsAre(Bucket(3, 1))); | 589 ElementsAre(Bucket(3, 1))); |
547 EXPECT_THAT(details->uma()->GetAllSamples( | 590 EXPECT_THAT(details->uma()->GetAllSamples( |
548 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 591 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
549 ElementsAre(Bucket(4, 1))); | 592 ElementsAre(Bucket(4, 1))); |
550 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4)); | 593 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4)); |
551 | 594 |
552 // Tab2 navigates its second iframe to a resource of extension2. This should | 595 // Tab2 navigates its second iframe to a resource of extension2. This should |
553 // share the existing extension2 process. | 596 // share the existing extension2 process. |
554 content::NavigateIframeToURL( | 597 content::NavigateIframeToURL( |
555 tab2, "child-1", extension2->GetResourceURL("/blank_iframe.html")); | 598 tab2, "child-1", extension2->GetResourceURL("/blank_iframe.html")); |
556 details = new TestMemoryDetails(); | 599 details = new TestMemoryDetails(); |
557 details->StartFetchAndWait(); | 600 details->StartFetchAndWait(); |
558 EXPECT_THAT(details->uma()->GetAllSamples( | 601 EXPECT_THAT(details->uma()->GetAllSamples( |
559 "SiteIsolation.CurrentRendererProcessCount"), | 602 "SiteIsolation.CurrentRendererProcessCount"), |
| 603 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 604 EXPECT_THAT(details->uma()->GetAllSamples( |
| 605 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
560 ElementsAre(Bucket(3, 1))); | 606 ElementsAre(Bucket(3, 1))); |
561 EXPECT_THAT(details->uma()->GetAllSamples( | 607 EXPECT_THAT(details->uma()->GetAllSamples( |
562 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 608 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
563 ElementsAre(Bucket(4, 1))); | 609 ElementsAre(Bucket(4, 1))); |
564 EXPECT_THAT(details->uma()->GetAllSamples( | 610 EXPECT_THAT(details->uma()->GetAllSamples( |
565 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 611 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
566 ElementsAre(Bucket(3, 1))); | 612 ElementsAre(Bucket(3, 1))); |
567 EXPECT_THAT(details->uma()->GetAllSamples( | 613 EXPECT_THAT(details->uma()->GetAllSamples( |
568 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 614 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
569 ElementsAre(Bucket(4, 1))); | 615 ElementsAre(Bucket(4, 1))); |
570 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4)); | 616 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4)); |
571 | 617 |
572 // Install extension3 (identical config to extension2) | 618 // Install extension3 (identical config to extension2) |
573 const Extension* extension3 = CreateExtension("Extension Three", false); | 619 const Extension* extension3 = CreateExtension("Extension Three", false); |
574 | 620 |
575 // Navigate Tab2 to a top-level page from extension3. There are four processes | 621 // Navigate Tab2 to a top-level page from extension3. There are four processes |
576 // now: one for tab1's main frame, and one for each of the extensions: | 622 // now: one for tab1's main frame, and one for each of the extensions: |
577 // extension1 has a process because it has a background page; extension2 is | 623 // extension1 has a process because it has a background page; extension2 is |
578 // used as an iframe in tab1, and extension3 is the top-level frame in tab2. | 624 // used as an iframe in tab1, and extension3 is the top-level frame in tab2. |
579 ui_test_utils::NavigateToURL(browser(), | 625 ui_test_utils::NavigateToURL(browser(), |
580 extension3->GetResourceURL("blank_iframe.html")); | 626 extension3->GetResourceURL("blank_iframe.html")); |
581 details = new TestMemoryDetails(); | 627 details = new TestMemoryDetails(); |
582 details->StartFetchAndWait(); | 628 details->StartFetchAndWait(); |
583 EXPECT_THAT(details->uma()->GetAllSamples( | 629 EXPECT_THAT(details->uma()->GetAllSamples( |
584 "SiteIsolation.CurrentRendererProcessCount"), | 630 "SiteIsolation.CurrentRendererProcessCount"), |
| 631 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 632 EXPECT_THAT(details->uma()->GetAllSamples( |
| 633 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
585 ElementsAre(Bucket(3, 1))); | 634 ElementsAre(Bucket(3, 1))); |
586 EXPECT_THAT(details->uma()->GetAllSamples( | 635 EXPECT_THAT(details->uma()->GetAllSamples( |
587 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 636 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
588 ElementsAre(Bucket(4, 1))); | 637 ElementsAre(Bucket(4, 1))); |
589 EXPECT_THAT(details->uma()->GetAllSamples( | 638 EXPECT_THAT(details->uma()->GetAllSamples( |
590 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 639 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
591 ElementsAre(Bucket(4, 1))); | 640 ElementsAre(Bucket(4, 1))); |
592 EXPECT_THAT(details->uma()->GetAllSamples( | 641 EXPECT_THAT(details->uma()->GetAllSamples( |
593 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 642 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
594 ElementsAre(Bucket(4, 1))); | 643 ElementsAre(Bucket(4, 1))); |
595 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4)); | 644 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4)); |
596 | 645 |
597 // Navigate tab2 to a different extension3 page containing a web iframe. The | 646 // Navigate tab2 to a different extension3 page containing a web iframe. The |
598 // iframe should get its own process. The lower bound number indicates that, | 647 // iframe should get its own process. The lower bound number indicates that, |
599 // in theory, the iframe could share a process with tab1's main frame. | 648 // in theory, the iframe could share a process with tab1's main frame. |
600 ui_test_utils::NavigateToURL(browser(), | 649 ui_test_utils::NavigateToURL(browser(), |
601 extension3->GetResourceURL("http_iframe.html")); | 650 extension3->GetResourceURL("http_iframe.html")); |
602 details = new TestMemoryDetails(); | 651 details = new TestMemoryDetails(); |
603 details->StartFetchAndWait(); | 652 details->StartFetchAndWait(); |
604 EXPECT_THAT(details->uma()->GetAllSamples( | 653 EXPECT_THAT(details->uma()->GetAllSamples( |
605 "SiteIsolation.CurrentRendererProcessCount"), | 654 "SiteIsolation.CurrentRendererProcessCount"), |
| 655 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 656 EXPECT_THAT(details->uma()->GetAllSamples( |
| 657 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
606 ElementsAre(Bucket(3, 1))); | 658 ElementsAre(Bucket(3, 1))); |
607 EXPECT_THAT(details->uma()->GetAllSamples( | 659 EXPECT_THAT(details->uma()->GetAllSamples( |
608 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 660 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
609 ElementsAre(Bucket(5, 1))); | 661 ElementsAre(Bucket(5, 1))); |
610 EXPECT_THAT(details->uma()->GetAllSamples( | 662 EXPECT_THAT(details->uma()->GetAllSamples( |
611 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 663 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
612 ElementsAre(Bucket(4, 1))); | 664 ElementsAre(Bucket(4, 1))); |
613 EXPECT_THAT(details->uma()->GetAllSamples( | 665 EXPECT_THAT(details->uma()->GetAllSamples( |
614 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 666 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
615 ElementsAre(Bucket(5, 1))); | 667 ElementsAre(Bucket(5, 1))); |
616 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(5)); | 668 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(5)); |
617 | 669 |
618 // Navigate tab1 to an extension3 page with an extension3 iframe. There should | 670 // Navigate tab1 to an extension3 page with an extension3 iframe. There should |
619 // be three processes estimated by IsolateExtensions: one for extension3, one | 671 // be three processes estimated by IsolateExtensions: one for extension3, one |
620 // for extension1's background page, and one for the web iframe in tab2. | 672 // for extension1's background page, and one for the web iframe in tab2. |
621 browser()->tab_strip_model()->ActivateTabAt(0, true); | 673 browser()->tab_strip_model()->ActivateTabAt(0, true); |
622 ui_test_utils::NavigateToURL(browser(), | 674 ui_test_utils::NavigateToURL(browser(), |
623 extension3->GetResourceURL("blank_iframe.html")); | 675 extension3->GetResourceURL("blank_iframe.html")); |
624 details = new TestMemoryDetails(); | 676 details = new TestMemoryDetails(); |
625 details->StartFetchAndWait(); | 677 details->StartFetchAndWait(); |
626 EXPECT_THAT(details->uma()->GetAllSamples( | 678 EXPECT_THAT(details->uma()->GetAllSamples( |
627 "SiteIsolation.CurrentRendererProcessCount"), | 679 "SiteIsolation.CurrentRendererProcessCount"), |
| 680 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 681 EXPECT_THAT(details->uma()->GetAllSamples( |
| 682 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
628 ElementsAre(Bucket(2, 1))); | 683 ElementsAre(Bucket(2, 1))); |
629 EXPECT_THAT(details->uma()->GetAllSamples( | 684 EXPECT_THAT(details->uma()->GetAllSamples( |
630 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 685 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
631 ElementsAre(Bucket(3, 1))); | 686 ElementsAre(Bucket(3, 1))); |
632 EXPECT_THAT(details->uma()->GetAllSamples( | 687 EXPECT_THAT(details->uma()->GetAllSamples( |
633 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 688 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
634 ElementsAre(Bucket(3, 1))); | 689 ElementsAre(Bucket(3, 1))); |
635 EXPECT_THAT(details->uma()->GetAllSamples( | 690 EXPECT_THAT(details->uma()->GetAllSamples( |
636 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 691 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
637 ElementsAre(Bucket(3, 1))); | 692 ElementsAre(Bucket(3, 1))); |
638 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); | 693 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); |
639 | 694 |
640 // Now navigate tab1 to an extension3 page with a web iframe. This could share | 695 // Now navigate tab1 to an extension3 page with a web iframe. This could share |
641 // a process with tab2's iframe (the LowerBound number), or it could get its | 696 // a process with tab2's iframe (the LowerBound number), or it could get its |
642 // own process (the Estimate number). | 697 // own process (the Estimate number). |
643 ui_test_utils::NavigateToURL(browser(), | 698 ui_test_utils::NavigateToURL(browser(), |
644 extension3->GetResourceURL("http_iframe.html")); | 699 extension3->GetResourceURL("http_iframe.html")); |
645 details = new TestMemoryDetails(); | 700 details = new TestMemoryDetails(); |
646 details->StartFetchAndWait(); | 701 details->StartFetchAndWait(); |
647 EXPECT_THAT(details->uma()->GetAllSamples( | 702 EXPECT_THAT(details->uma()->GetAllSamples( |
648 "SiteIsolation.CurrentRendererProcessCount"), | 703 "SiteIsolation.CurrentRendererProcessCount"), |
| 704 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 705 EXPECT_THAT(details->uma()->GetAllSamples( |
| 706 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
649 ElementsAre(Bucket(2, 1))); | 707 ElementsAre(Bucket(2, 1))); |
650 EXPECT_THAT(details->uma()->GetAllSamples( | 708 EXPECT_THAT(details->uma()->GetAllSamples( |
651 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 709 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
652 ElementsAre(Bucket(4, 1))); | 710 ElementsAre(Bucket(4, 1))); |
653 EXPECT_THAT(details->uma()->GetAllSamples( | 711 EXPECT_THAT(details->uma()->GetAllSamples( |
654 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 712 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
655 ElementsAre(Bucket(3, 1))); | 713 ElementsAre(Bucket(3, 1))); |
656 EXPECT_THAT(details->uma()->GetAllSamples( | 714 EXPECT_THAT(details->uma()->GetAllSamples( |
657 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 715 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
658 ElementsAre(Bucket(4, 1))); | 716 ElementsAre(Bucket(4, 1))); |
(...skipping 10 matching lines...) Expand all Loading... |
669 // extension with web accessible resources. | 727 // extension with web accessible resources. |
670 const Extension* extension = CreateExtension("Test Extension", false); | 728 const Extension* extension = CreateExtension("Test Extension", false); |
671 | 729 |
672 ui_test_utils::NavigateToURL( | 730 ui_test_utils::NavigateToURL( |
673 browser(), extension->GetResourceURL("/two_http_iframes.html")); | 731 browser(), extension->GetResourceURL("/two_http_iframes.html")); |
674 | 732 |
675 details = new TestMemoryDetails(); | 733 details = new TestMemoryDetails(); |
676 details->StartFetchAndWait(); | 734 details->StartFetchAndWait(); |
677 EXPECT_THAT(details->uma()->GetAllSamples( | 735 EXPECT_THAT(details->uma()->GetAllSamples( |
678 "SiteIsolation.CurrentRendererProcessCount"), | 736 "SiteIsolation.CurrentRendererProcessCount"), |
| 737 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 738 EXPECT_THAT(details->uma()->GetAllSamples( |
| 739 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
679 ElementsAre(Bucket(1, 1))); | 740 ElementsAre(Bucket(1, 1))); |
680 EXPECT_THAT(details->uma()->GetAllSamples( | 741 EXPECT_THAT(details->uma()->GetAllSamples( |
681 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 742 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
682 ElementsAre(Bucket(2, 1))); | 743 ElementsAre(Bucket(2, 1))); |
683 EXPECT_THAT(details->uma()->GetAllSamples( | 744 EXPECT_THAT(details->uma()->GetAllSamples( |
684 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 745 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
685 ElementsAre(Bucket(2, 1))); | 746 ElementsAre(Bucket(2, 1))); |
686 EXPECT_THAT(details->uma()->GetAllSamples( | 747 EXPECT_THAT(details->uma()->GetAllSamples( |
687 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 748 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
688 ElementsAre(Bucket(2, 1))); | 749 ElementsAre(Bucket(2, 1))); |
689 // TODO(nick): https://crbug.com/512560 Make the number below agree with the | 750 // TODO(nick): https://crbug.com/512560 Make the number below agree with the |
690 // estimates above, which assume consolidation of subframe processes. | 751 // estimates above, which assume consolidation of subframe processes. |
691 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); | 752 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); |
692 } | 753 } |
693 | 754 |
694 // Verifies that --isolate-extensions doesn't isolate hosted apps. | 755 // Verifies that --isolate-extensions doesn't isolate hosted apps. |
695 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensionsHostedApps) { | 756 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensionsHostedApps) { |
696 GURL app_with_web_iframe_url = embedded_test_server()->GetURL( | 757 GURL app_with_web_iframe_url = embedded_test_server()->GetURL( |
697 "app.org", "/cross_site_iframe_factory.html?app.org(b.com)"); | 758 "app.org", "/cross_site_iframe_factory.html?app.org(b.com)"); |
698 GURL app_in_web_iframe_url = embedded_test_server()->GetURL( | 759 GURL app_in_web_iframe_url = embedded_test_server()->GetURL( |
699 "b.com", "/cross_site_iframe_factory.html?b.com(app.org)"); | 760 "b.com", "/cross_site_iframe_factory.html?b.com(app.org)"); |
700 | 761 |
701 // No hosted app is installed: app.org just behaves like a normal domain. | 762 // No hosted app is installed: app.org just behaves like a normal domain. |
702 ui_test_utils::NavigateToURL(browser(), app_with_web_iframe_url); | 763 ui_test_utils::NavigateToURL(browser(), app_with_web_iframe_url); |
703 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails(); | 764 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails(); |
704 details->StartFetchAndWait(); | 765 details->StartFetchAndWait(); |
705 EXPECT_THAT(details->uma()->GetAllSamples( | 766 EXPECT_THAT(details->uma()->GetAllSamples( |
706 "SiteIsolation.CurrentRendererProcessCount"), | 767 "SiteIsolation.CurrentRendererProcessCount"), |
| 768 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 769 EXPECT_THAT(details->uma()->GetAllSamples( |
| 770 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
707 ElementsAre(Bucket(1, 1))); | 771 ElementsAre(Bucket(1, 1))); |
708 EXPECT_THAT(details->uma()->GetAllSamples( | 772 EXPECT_THAT(details->uma()->GetAllSamples( |
709 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 773 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
710 ElementsAre(Bucket(1, 1))); | 774 ElementsAre(Bucket(1, 1))); |
711 EXPECT_THAT(details->uma()->GetAllSamples( | 775 EXPECT_THAT(details->uma()->GetAllSamples( |
712 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 776 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
713 ElementsAre(Bucket(1, 1))); | 777 ElementsAre(Bucket(1, 1))); |
714 EXPECT_THAT(details->uma()->GetAllSamples( | 778 EXPECT_THAT(details->uma()->GetAllSamples( |
715 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 779 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
716 ElementsAre(Bucket(1, 1))); | 780 ElementsAre(Bucket(1, 1))); |
717 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(1)); | 781 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(1)); |
718 EXPECT_THAT(details->uma()->GetAllSamples( | 782 EXPECT_THAT(details->uma()->GetAllSamples( |
719 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), | 783 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), |
720 ElementsAre(Bucket(2, 1))); | 784 ElementsAre(Bucket(2, 1))); |
721 EXPECT_THAT(details->uma()->GetAllSamples( | 785 EXPECT_THAT(details->uma()->GetAllSamples( |
722 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), | 786 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), |
723 ElementsAre(Bucket(2, 1))); | 787 ElementsAre(Bucket(2, 1))); |
724 EXPECT_THAT(details->uma()->GetAllSamples( | 788 EXPECT_THAT(details->uma()->GetAllSamples( |
725 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), | 789 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), |
726 ElementsAre(Bucket(2, 1))); | 790 ElementsAre(Bucket(2, 1))); |
727 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2)); | 791 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2)); |
728 | 792 |
729 ui_test_utils::NavigateToURL(browser(), app_in_web_iframe_url); | 793 ui_test_utils::NavigateToURL(browser(), app_in_web_iframe_url); |
730 details = new TestMemoryDetails(); | 794 details = new TestMemoryDetails(); |
731 details->StartFetchAndWait(); | 795 details->StartFetchAndWait(); |
732 EXPECT_THAT(details->uma()->GetAllSamples( | 796 EXPECT_THAT(details->uma()->GetAllSamples( |
733 "SiteIsolation.CurrentRendererProcessCount"), | 797 "SiteIsolation.CurrentRendererProcessCount"), |
| 798 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 799 EXPECT_THAT(details->uma()->GetAllSamples( |
| 800 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
734 ElementsAre(Bucket(1, 1))); | 801 ElementsAre(Bucket(1, 1))); |
735 EXPECT_THAT(details->uma()->GetAllSamples( | 802 EXPECT_THAT(details->uma()->GetAllSamples( |
736 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 803 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
737 ElementsAre(Bucket(1, 1))); | 804 ElementsAre(Bucket(1, 1))); |
738 EXPECT_THAT(details->uma()->GetAllSamples( | 805 EXPECT_THAT(details->uma()->GetAllSamples( |
739 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 806 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
740 ElementsAre(Bucket(1, 1))); | 807 ElementsAre(Bucket(1, 1))); |
741 EXPECT_THAT(details->uma()->GetAllSamples( | 808 EXPECT_THAT(details->uma()->GetAllSamples( |
742 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 809 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
743 ElementsAre(Bucket(1, 1))); | 810 ElementsAre(Bucket(1, 1))); |
(...skipping 12 matching lines...) Expand all Loading... |
756 // Now install app.org as a hosted app. | 823 // Now install app.org as a hosted app. |
757 CreateHostedApp("App", GURL("http://app.org")); | 824 CreateHostedApp("App", GURL("http://app.org")); |
758 | 825 |
759 // Reload the same two pages, and verify that the hosted app still is not | 826 // Reload the same two pages, and verify that the hosted app still is not |
760 // isolated by --isolate-extensions, but is isolated by --site-per-process. | 827 // isolated by --isolate-extensions, but is isolated by --site-per-process. |
761 ui_test_utils::NavigateToURL(browser(), app_with_web_iframe_url); | 828 ui_test_utils::NavigateToURL(browser(), app_with_web_iframe_url); |
762 details = new TestMemoryDetails(); | 829 details = new TestMemoryDetails(); |
763 details->StartFetchAndWait(); | 830 details->StartFetchAndWait(); |
764 EXPECT_THAT(details->uma()->GetAllSamples( | 831 EXPECT_THAT(details->uma()->GetAllSamples( |
765 "SiteIsolation.CurrentRendererProcessCount"), | 832 "SiteIsolation.CurrentRendererProcessCount"), |
| 833 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 834 EXPECT_THAT(details->uma()->GetAllSamples( |
| 835 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
766 ElementsAre(Bucket(1, 1))); | 836 ElementsAre(Bucket(1, 1))); |
767 EXPECT_THAT(details->uma()->GetAllSamples( | 837 EXPECT_THAT(details->uma()->GetAllSamples( |
768 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 838 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
769 ElementsAre(Bucket(1, 1))); | 839 ElementsAre(Bucket(1, 1))); |
770 EXPECT_THAT(details->uma()->GetAllSamples( | 840 EXPECT_THAT(details->uma()->GetAllSamples( |
771 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 841 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
772 ElementsAre(Bucket(1, 1))); | 842 ElementsAre(Bucket(1, 1))); |
773 EXPECT_THAT(details->uma()->GetAllSamples( | 843 EXPECT_THAT(details->uma()->GetAllSamples( |
774 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 844 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
775 ElementsAre(Bucket(1, 1))); | 845 ElementsAre(Bucket(1, 1))); |
776 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(1)); | 846 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(1)); |
777 EXPECT_THAT(details->uma()->GetAllSamples( | 847 EXPECT_THAT(details->uma()->GetAllSamples( |
778 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), | 848 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), |
779 ElementsAre(Bucket(2, 1))); | 849 ElementsAre(Bucket(2, 1))); |
780 EXPECT_THAT(details->uma()->GetAllSamples( | 850 EXPECT_THAT(details->uma()->GetAllSamples( |
781 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), | 851 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), |
782 ElementsAre(Bucket(2, 1))); | 852 ElementsAre(Bucket(2, 1))); |
783 EXPECT_THAT(details->uma()->GetAllSamples( | 853 EXPECT_THAT(details->uma()->GetAllSamples( |
784 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), | 854 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), |
785 ElementsAre(Bucket(2, 1))); | 855 ElementsAre(Bucket(2, 1))); |
786 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2)); | 856 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2)); |
787 | 857 |
788 ui_test_utils::NavigateToURL(browser(), app_in_web_iframe_url); | 858 ui_test_utils::NavigateToURL(browser(), app_in_web_iframe_url); |
789 details = new TestMemoryDetails(); | 859 details = new TestMemoryDetails(); |
790 details->StartFetchAndWait(); | 860 details->StartFetchAndWait(); |
791 EXPECT_THAT(details->uma()->GetAllSamples( | 861 EXPECT_THAT(details->uma()->GetAllSamples( |
792 "SiteIsolation.CurrentRendererProcessCount"), | 862 "SiteIsolation.CurrentRendererProcessCount"), |
| 863 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 864 EXPECT_THAT(details->uma()->GetAllSamples( |
| 865 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
793 ElementsAre(Bucket(1, 1))); | 866 ElementsAre(Bucket(1, 1))); |
794 EXPECT_THAT(details->uma()->GetAllSamples( | 867 EXPECT_THAT(details->uma()->GetAllSamples( |
795 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 868 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
796 ElementsAre(Bucket(1, 1))); | 869 ElementsAre(Bucket(1, 1))); |
797 EXPECT_THAT(details->uma()->GetAllSamples( | 870 EXPECT_THAT(details->uma()->GetAllSamples( |
798 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 871 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
799 ElementsAre(Bucket(1, 1))); | 872 ElementsAre(Bucket(1, 1))); |
800 EXPECT_THAT(details->uma()->GetAllSamples( | 873 EXPECT_THAT(details->uma()->GetAllSamples( |
801 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 874 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
802 ElementsAre(Bucket(1, 1))); | 875 ElementsAre(Bucket(1, 1))); |
803 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(1)); | 876 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(1)); |
804 EXPECT_THAT(details->uma()->GetAllSamples( | 877 EXPECT_THAT(details->uma()->GetAllSamples( |
805 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), | 878 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), |
806 ElementsAre(Bucket(2, 1))); | 879 ElementsAre(Bucket(2, 1))); |
807 EXPECT_THAT(details->uma()->GetAllSamples( | 880 EXPECT_THAT(details->uma()->GetAllSamples( |
808 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), | 881 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), |
809 ElementsAre(Bucket(2, 1))); | 882 ElementsAre(Bucket(2, 1))); |
810 EXPECT_THAT(details->uma()->GetAllSamples( | 883 EXPECT_THAT(details->uma()->GetAllSamples( |
811 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), | 884 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), |
812 ElementsAre(Bucket(2, 1))); | 885 ElementsAre(Bucket(2, 1))); |
813 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2)); | 886 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2)); |
814 } | 887 } |
OLD | NEW |