Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 665 // Wait for the heap stats to reflect this. | 665 // Wait for the heap stats to reflect this. |
| 666 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerStatToExceed( | 666 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerStatToExceed( |
| 667 MatchTab("title1.html"), ColumnSpecifier::V8_MEMORY, minimal_heap_size)); | 667 MatchTab("title1.html"), ColumnSpecifier::V8_MEMORY, minimal_heap_size)); |
| 668 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerStatToExceed( | 668 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerStatToExceed( |
| 669 MatchTab("title1.html"), ColumnSpecifier::V8_MEMORY_USED, | 669 MatchTab("title1.html"), ColumnSpecifier::V8_MEMORY_USED, |
| 670 minimal_heap_size)); | 670 minimal_heap_size)); |
| 671 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); | 671 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); |
| 672 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("title1.html"))); | 672 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("title1.html"))); |
| 673 } | 673 } |
| 674 | 674 |
| 675 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, SentDataObserved) { | |
| 676 ShowTaskManager(); | |
| 677 GURL test_gurl = embedded_test_server()->GetURL("/title1.html"); | |
| 678 | |
| 679 ui_test_utils::NavigateToURL(browser(), test_gurl); | |
| 680 std::string test_js = R"( | |
| 681 document.title = 'network use'; | |
| 682 var mem = new Uint8Array(16 << 20); | |
| 683 for (var i = 0; i < mem.length; i += 16) { | |
| 684 mem[i] = i; | |
| 685 } | |
| 686 var formData = new FormData(); | |
| 687 formData.append('StringKey1', new Blob([mem])); | |
| 688 var request = | |
| 689 new Request(location.href, {method: 'POST', body: formData}); | |
| 690 fetch(request).then(response => response.text()); | |
| 691 )"; | |
| 692 | |
| 693 browser() | |
| 694 ->tab_strip_model() | |
| 695 ->GetActiveWebContents() | |
| 696 ->GetMainFrame() | |
| 697 ->ExecuteJavaScriptForTests(base::UTF8ToUTF16(test_js)); | |
|
ncarter (slow)
2017/06/20 19:52:27
Add in:
// TODO(cburn): The assertion below curre
cburn
2017/06/20 21:34:55
Done.
| |
| 698 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerStatToExceed( | |
| 699 MatchTab("network use"), ColumnSpecifier::NETWORK_USE, 16000000)); | |
| 700 } | |
| 701 | |
| 702 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, TotalSentDataObserved) { | |
| 703 ShowTaskManager(); | |
| 704 GURL test_gurl = embedded_test_server()->GetURL("/title1.html"); | |
| 705 | |
| 706 ui_test_utils::NavigateToURL(browser(), test_gurl); | |
| 707 std::string test_js = R"( | |
| 708 document.title = 'network use'; | |
| 709 var mem = new Uint8Array(16 << 20); | |
| 710 for (var i = 0; i < mem.length; i += 16) { | |
| 711 mem[i] = i; | |
| 712 } | |
| 713 var formData = new FormData(); | |
| 714 formData.append('StringKey1', new Blob([mem])); | |
| 715 var request = | |
| 716 new Request(location.href, {method: 'POST', body: formData}); | |
| 717 fetch(request).then(response => response.text()); | |
| 718 )"; | |
| 719 | |
| 720 browser() | |
| 721 ->tab_strip_model() | |
| 722 ->GetActiveWebContents() | |
| 723 ->GetMainFrame() | |
| 724 ->ExecuteJavaScriptForTests(base::UTF8ToUTF16(test_js)); | |
| 725 | |
| 726 // This test uses |setTimeout| to exceed the Nyquist ratio to ensure that at | |
| 727 // least 1 refresh has happened of no traffic. | |
| 728 test_js = R"( | |
| 729 var request = | |
| 730 new Request(location.href, {method: 'POST', body: formData}); | |
| 731 setTimeout( | |
| 732 () => {fetch(request).then(response => response.text())}, 2000); | |
| 733 )"; | |
| 734 | |
| 735 browser() | |
| 736 ->tab_strip_model() | |
| 737 ->GetActiveWebContents() | |
| 738 ->GetMainFrame() | |
| 739 ->ExecuteJavaScriptForTests(base::UTF8ToUTF16(test_js)); | |
| 740 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerStatToExceed( | |
| 741 MatchTab("network use"), ColumnSpecifier::TOTAL_NETWORK_USE, | |
| 742 16000000 * 2)); | |
| 743 } | |
| 744 | |
| 675 // Checks that task manager counts idle wakeups. | 745 // Checks that task manager counts idle wakeups. |
| 676 // Flakily fails on Mac: http://crbug.com/639939 | 746 // Flakily fails on Mac: http://crbug.com/639939 |
| 677 #if defined(OS_MACOSX) | 747 #if defined(OS_MACOSX) |
| 678 #define MAYBE_IdleWakeups DISABLED_IdleWakeups | 748 #define MAYBE_IdleWakeups DISABLED_IdleWakeups |
| 679 #else | 749 #else |
| 680 #define MAYBE_IdleWakeups IdleWakeups | 750 #define MAYBE_IdleWakeups IdleWakeups |
| 681 #endif // defined(OS_MACOSX) | 751 #endif // defined(OS_MACOSX) |
| 682 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, | 752 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, |
| 683 MAYBE_IdleWakeups) { | 753 MAYBE_IdleWakeups) { |
| 684 ShowTaskManager(); | 754 ShowTaskManager(); |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1168 | 1238 |
| 1169 // Because the subframes for tab 2 are nested, their order is deterministic. | 1239 // Because the subframes for tab 2 are nested, their order is deterministic. |
| 1170 EXPECT_EQ("Subframe: http://a.com/", | 1240 EXPECT_EQ("Subframe: http://a.com/", |
| 1171 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 1))); | 1241 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 1))); |
| 1172 EXPECT_EQ("Subframe: http://c.com/", | 1242 EXPECT_EQ("Subframe: http://c.com/", |
| 1173 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 2))); | 1243 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 2))); |
| 1174 EXPECT_EQ("Subframe: http://b.com/", | 1244 EXPECT_EQ("Subframe: http://b.com/", |
| 1175 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 3))); | 1245 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 3))); |
| 1176 } | 1246 } |
| 1177 } | 1247 } |
| OLD | NEW |