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 mem = new Uint8Array(16 << 20); | |
682 for (var i = 0; i < mem.length; i += 16) | |
683 mem[i] = i; | |
684 var formData = new FormData(); | |
685 formData.append('StringKey1', new Blob([mem])); | |
686 var request = new Request( | |
687 location.href, | |
688 {method: 'POST', body: formData}); | |
689 fetch(request) | |
690 .then(response => response.text()) | |
691 .then(body => domAutomationController.send("okay")) | |
692 .catch(error => domAutomationController.send("failed " + error)); | |
693 )"; | |
694 std::string ok; | |
695 | |
696 ASSERT_TRUE(content::ExecuteScriptAndExtractString( | |
697 browser()->tab_strip_model()->GetActiveWebContents(), test_js, &ok)); | |
698 ASSERT_EQ("okay", ok); | |
699 | |
700 ASSERT_NO_FATAL_FAILURE( | |
701 WaitForTaskManagerStatToExceed(MatchTab(test_gurl.GetContent().c_str()), | |
ncarter (slow)
2017/06/17 00:21:02
Just use MatchTab("title1.html") -- it's consisten
cburn
2017/06/19 22:07:08
Done.
| |
702 ColumnSpecifier::NETWORK_USE, 16000000)); | |
ncarter (slow)
2017/06/17 00:21:02
I worry that this might be flaky, for two reasons:
cburn
2017/06/19 22:07:08
Done.
| |
703 } | |
704 | |
705 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, TotalSentDataObserved) { | |
706 ShowTaskManager(); | |
707 GURL test_gurl = embedded_test_server()->GetURL("/title1.html"); | |
708 | |
709 ui_test_utils::NavigateToURL(browser(), test_gurl); | |
710 std::string test_js = R"( | |
711 mem = new Uint8Array(16 << 20); | |
ncarter (slow)
2017/06/17 00:21:02
"var mem ="
cburn
2017/06/19 22:07:08
Done.
| |
712 for (var i = 0; i < mem.length; i += 16) | |
713 mem[i] = i; | |
714 var formData = new FormData(); | |
715 formData.append('StringKey1', new Blob([mem])); | |
716 var request = new Request( | |
717 location.href, | |
718 {method: 'POST', body: formData}); | |
719 fetch(request) | |
720 .then(response => response.text()) | |
721 .then(body => domAutomationController.send("okay")) | |
722 .catch(error => domAutomationController.send("failed " + error)); | |
723 )"; | |
724 std::string ok; | |
725 | |
726 ASSERT_TRUE(content::ExecuteScriptAndExtractString( | |
727 browser()->tab_strip_model()->GetActiveWebContents(), test_js, &ok)); | |
728 ASSERT_EQ("okay", ok); | |
729 test_js = R"( | |
730 mem = new Uint8Array(16 << 20); | |
731 for (var i = 0; i < mem.length; i += 16) | |
732 mem[i] = i; | |
ncarter (slow)
2017/06/17 00:21:01
mem already exists from the previous script execut
cburn
2017/06/19 22:07:08
Done.
| |
733 var formData = new FormData(); | |
734 formData.append('StringKey1', new Blob([mem])); | |
735 var request = new Request( | |
736 location.href, | |
737 {method: 'POST', body: formData}); | |
738 setTimeout( function(){fetch(request) | |
ncarter (slow)
2017/06/17 00:21:02
Use lambda syntax here, since it's used elsewhere
cburn
2017/06/19 22:07:08
Done.
| |
739 .then(response => response.text()) | |
740 .then(body => domAutomationController.send("okay")) | |
741 .catch(error => domAutomationController.send("failed " + error))}, | |
742 2000); | |
ncarter (slow)
2017/06/17 00:21:01
What's the importance of this two-second wait? (Is
cburn
2017/06/19 22:07:08
Done.
| |
743 )"; | |
744 ASSERT_TRUE(content::ExecuteScriptAndExtractString( | |
745 browser()->tab_strip_model()->GetActiveWebContents(), test_js, &ok)); | |
746 ASSERT_EQ("okay", ok); | |
747 | |
748 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerStatToExceed( | |
749 MatchTab(test_gurl.GetContent().c_str()), | |
750 ColumnSpecifier::TOTAL_NETWORK_USE, 16000000 * 2)); | |
751 } | |
752 | |
675 // Checks that task manager counts idle wakeups. | 753 // Checks that task manager counts idle wakeups. |
676 // Flakily fails on Mac: http://crbug.com/639939 | 754 // Flakily fails on Mac: http://crbug.com/639939 |
677 #if defined(OS_MACOSX) | 755 #if defined(OS_MACOSX) |
678 #define MAYBE_IdleWakeups DISABLED_IdleWakeups | 756 #define MAYBE_IdleWakeups DISABLED_IdleWakeups |
679 #else | 757 #else |
680 #define MAYBE_IdleWakeups IdleWakeups | 758 #define MAYBE_IdleWakeups IdleWakeups |
681 #endif // defined(OS_MACOSX) | 759 #endif // defined(OS_MACOSX) |
682 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, | 760 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, |
683 MAYBE_IdleWakeups) { | 761 MAYBE_IdleWakeups) { |
684 ShowTaskManager(); | 762 ShowTaskManager(); |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1168 | 1246 |
1169 // Because the subframes for tab 2 are nested, their order is deterministic. | 1247 // Because the subframes for tab 2 are nested, their order is deterministic. |
1170 EXPECT_EQ("Subframe: http://a.com/", | 1248 EXPECT_EQ("Subframe: http://a.com/", |
1171 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 1))); | 1249 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 1))); |
1172 EXPECT_EQ("Subframe: http://c.com/", | 1250 EXPECT_EQ("Subframe: http://c.com/", |
1173 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 2))); | 1251 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 2))); |
1174 EXPECT_EQ("Subframe: http://b.com/", | 1252 EXPECT_EQ("Subframe: http://b.com/", |
1175 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 3))); | 1253 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 3))); |
1176 } | 1254 } |
1177 } | 1255 } |
OLD | NEW |