Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: chrome/browser/task_management/task_manager_browsertest.cc

Issue 2178733002: Task manager should support Idle Wakeups on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed build error on win_clang Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 // Wait for the heap stats to reflect this. 854 // Wait for the heap stats to reflect this.
855 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerStatToExceed( 855 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerStatToExceed(
856 MatchTab("title1.html"), ColumnSpecifier::V8_MEMORY, minimal_heap_size)); 856 MatchTab("title1.html"), ColumnSpecifier::V8_MEMORY, minimal_heap_size));
857 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerStatToExceed( 857 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerStatToExceed(
858 MatchTab("title1.html"), ColumnSpecifier::V8_MEMORY_USED, 858 MatchTab("title1.html"), ColumnSpecifier::V8_MEMORY_USED,
859 minimal_heap_size)); 859 minimal_heap_size));
860 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); 860 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
861 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("title1.html"))); 861 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("title1.html")));
862 } 862 }
863 863
864 // Checks that task manager counts idle wakeups.
865 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest,
866 IdleWakeups) {
867 ShowTaskManager();
868 model()->ToggleColumnVisibility(ColumnSpecifier::IDLE_WAKEUPS);
869
870 ui_test_utils::NavigateToURL(browser(), GetTestURL());
871
872 std::string test_js =
873 "function myWait() {\n"
874 " setTimeout(function() { myWait(); }, 1)\n"
875 "}\n"
876 "myWait();\n"
877 "window.domAutomationController.send(\"okay\");\n";
878
879 std::string ok;
880 ASSERT_TRUE(content::ExecuteScriptAndExtractString(
881 browser()->tab_strip_model()->GetActiveWebContents(), test_js, &ok));
882 ASSERT_EQ("okay", ok);
883
884 // The script above should trigger a lot of idle wakeups - up to 1000 per
885 // second. Let's make sure we get at least 100 (in case the test runs slow).
886 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerStatToExceed(
887 MatchTab("title1.html"), ColumnSpecifier::IDLE_WAKEUPS, 100));
888 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
889 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("title1.html")));
890 }
891
864 // Checks that task manager counts utility process JS heap size. 892 // Checks that task manager counts utility process JS heap size.
865 IN_PROC_BROWSER_TEST_F(TaskManagerUtilityProcessBrowserTest, 893 IN_PROC_BROWSER_TEST_F(TaskManagerUtilityProcessBrowserTest,
866 UtilityJSHeapMemory) { 894 UtilityJSHeapMemory) {
867 ShowTaskManager(); 895 ShowTaskManager();
868 model()->ToggleColumnVisibility(ColumnSpecifier::V8_MEMORY); 896 model()->ToggleColumnVisibility(ColumnSpecifier::V8_MEMORY);
869 897
870 auto proxy_resolver_name = 898 auto proxy_resolver_name =
871 l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME); 899 l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME);
872 ui_test_utils::NavigateToURL(browser(), GetTestURL()); 900 ui_test_utils::NavigateToURL(browser(), GetTestURL());
873 // The PAC script is trivial, so don't expect a large heap. 901 // The PAC script is trivial, so don't expect a large heap.
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 1286
1259 // Because the subframes for tab 2 are nested, their order is deterministic. 1287 // Because the subframes for tab 2 are nested, their order is deterministic.
1260 EXPECT_EQ("Subframe: http://a.com/", 1288 EXPECT_EQ("Subframe: http://a.com/",
1261 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 1))); 1289 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 1)));
1262 EXPECT_EQ("Subframe: http://c.com/", 1290 EXPECT_EQ("Subframe: http://c.com/",
1263 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 2))); 1291 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 2)));
1264 EXPECT_EQ("Subframe: http://b.com/", 1292 EXPECT_EQ("Subframe: http://b.com/",
1265 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 3))); 1293 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 3)));
1266 } 1294 }
1267 } 1295 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698