| 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 21 matching lines...) Expand all Loading... |
| 32 #include "chrome/browser/web_applications/web_app.h" | 32 #include "chrome/browser/web_applications/web_app.h" |
| 33 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
| 34 #include "chrome/grit/generated_resources.h" | 34 #include "chrome/grit/generated_resources.h" |
| 35 #include "chrome/test/base/in_process_browser_test.h" | 35 #include "chrome/test/base/in_process_browser_test.h" |
| 36 #include "chrome/test/base/ui_test_utils.h" | 36 #include "chrome/test/base/ui_test_utils.h" |
| 37 #include "components/infobars/core/confirm_infobar_delegate.h" | 37 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 38 #include "components/infobars/core/infobar.h" | 38 #include "components/infobars/core/infobar.h" |
| 39 #include "content/public/browser/notification_service.h" | 39 #include "content/public/browser/notification_service.h" |
| 40 #include "content/public/browser/page_navigator.h" | 40 #include "content/public/browser/page_navigator.h" |
| 41 #include "content/public/browser/render_frame_host.h" | 41 #include "content/public/browser/render_frame_host.h" |
| 42 #include "content/public/common/content_features.h" |
| 43 #include "content/public/common/content_switches.h" |
| 42 #include "content/public/test/browser_test_utils.h" | 44 #include "content/public/test/browser_test_utils.h" |
| 43 #include "content/public/test/content_browser_test_utils.h" | 45 #include "content/public/test/content_browser_test_utils.h" |
| 44 #include "extensions/browser/extension_system.h" | 46 #include "extensions/browser/extension_system.h" |
| 45 #include "extensions/common/extension.h" | 47 #include "extensions/common/extension.h" |
| 46 #include "net/dns/mock_host_resolver.h" | 48 #include "net/dns/mock_host_resolver.h" |
| 47 #include "net/test/embedded_test_server/embedded_test_server.h" | 49 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 48 #include "testing/gmock/include/gmock/gmock.h" | 50 #include "testing/gmock/include/gmock/gmock.h" |
| 49 #include "testing/gtest/include/gtest/gtest.h" | 51 #include "testing/gtest/include/gtest/gtest.h" |
| 50 #include "ui/base/l10n/l10n_util.h" | 52 #include "ui/base/l10n/l10n_util.h" |
| 51 #include "ui/base/page_transition_types.h" | 53 #include "ui/base/page_transition_types.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 command_line->AppendSwitch(switches::kV8PacMojoOutOfProcess); | 171 command_line->AppendSwitch(switches::kV8PacMojoOutOfProcess); |
| 170 command_line->AppendSwitchASCII( | 172 command_line->AppendSwitchASCII( |
| 171 switches::kProxyPacUrl, | 173 switches::kProxyPacUrl, |
| 172 "data:,function FindProxyForURL(url, host){return \"DIRECT;\";}"); | 174 "data:,function FindProxyForURL(url, host){return \"DIRECT;\";}"); |
| 173 } | 175 } |
| 174 | 176 |
| 175 private: | 177 private: |
| 176 DISALLOW_COPY_AND_ASSIGN(TaskManagerUtilityProcessBrowserTest); | 178 DISALLOW_COPY_AND_ASSIGN(TaskManagerUtilityProcessBrowserTest); |
| 177 }; | 179 }; |
| 178 | 180 |
| 181 class TaskManagerMemoryCoordinatorBrowserTest : public TaskManagerBrowserTest { |
| 182 public: |
| 183 TaskManagerMemoryCoordinatorBrowserTest() {} |
| 184 ~TaskManagerMemoryCoordinatorBrowserTest() override {} |
| 185 |
| 186 protected: |
| 187 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 188 command_line->AppendSwitchASCII(switches::kEnableFeatures, |
| 189 features::kMemoryCoordinator.name); |
| 190 } |
| 191 |
| 192 private: |
| 193 DISALLOW_COPY_AND_ASSIGN(TaskManagerMemoryCoordinatorBrowserTest); |
| 194 }; |
| 195 |
| 179 // Parameterized variant of TaskManagerBrowserTest which runs with/without | 196 // Parameterized variant of TaskManagerBrowserTest which runs with/without |
| 180 // --site-per-process, which enables out of process iframes (OOPIFs). | 197 // --site-per-process, which enables out of process iframes (OOPIFs). |
| 181 class TaskManagerOOPIFBrowserTest : public TaskManagerBrowserTest, | 198 class TaskManagerOOPIFBrowserTest : public TaskManagerBrowserTest, |
| 182 public testing::WithParamInterface<bool> { | 199 public testing::WithParamInterface<bool> { |
| 183 public: | 200 public: |
| 184 TaskManagerOOPIFBrowserTest() {} | 201 TaskManagerOOPIFBrowserTest() {} |
| 185 | 202 |
| 186 protected: | 203 protected: |
| 187 void SetUpCommandLine(base::CommandLine* command_line) override { | 204 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 188 TaskManagerBrowserTest::SetUpCommandLine(command_line); | 205 TaskManagerBrowserTest::SetUpCommandLine(command_line); |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 MatchUtility(proxy_resolver_name), ColumnSpecifier::V8_MEMORY, | 715 MatchUtility(proxy_resolver_name), ColumnSpecifier::V8_MEMORY, |
| 699 minimal_heap_size)); | 716 minimal_heap_size)); |
| 700 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerStatToExceed( | 717 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerStatToExceed( |
| 701 MatchUtility(proxy_resolver_name), ColumnSpecifier::V8_MEMORY_USED, | 718 MatchUtility(proxy_resolver_name), ColumnSpecifier::V8_MEMORY_USED, |
| 702 minimal_heap_size)); | 719 minimal_heap_size)); |
| 703 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyUtility())); | 720 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyUtility())); |
| 704 ASSERT_NO_FATAL_FAILURE( | 721 ASSERT_NO_FATAL_FAILURE( |
| 705 WaitForTaskManagerRows(1, MatchUtility(proxy_resolver_name))); | 722 WaitForTaskManagerRows(1, MatchUtility(proxy_resolver_name))); |
| 706 } | 723 } |
| 707 | 724 |
| 725 // Memory coordinator is not available on macos. crbug.com/617492 |
| 726 #if defined(OS_MACOSX) |
| 727 #define MAYBE_MemoryState DISABLED_MemoryState |
| 728 #else |
| 729 #define MAYBE_MemoryState MemoryState |
| 730 #endif // defined(OS_MACOSX) |
| 731 IN_PROC_BROWSER_TEST_F(TaskManagerMemoryCoordinatorBrowserTest, |
| 732 MAYBE_MemoryState) { |
| 733 ShowTaskManager(); |
| 734 model()->ToggleColumnVisibility(ColumnSpecifier::MEMORY_STATE); |
| 735 model()->ToggleColumnVisibility(ColumnSpecifier::V8_MEMORY_USED); |
| 736 |
| 737 ui_test_utils::NavigateToURL(browser(), GetTestURL()); |
| 738 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchTab("title1.html"))); |
| 739 |
| 740 // Wait until the tab consumes some memory so that memory state is refreshed. |
| 741 size_t minimal_heap_size = 1024; |
| 742 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerStatToExceed( |
| 743 MatchTab("title1.html"), ColumnSpecifier::V8_MEMORY_USED, |
| 744 minimal_heap_size)); |
| 745 |
| 746 int row = FindResourceIndex(MatchTab("title1.html")); |
| 747 ASSERT_NE(-1, row); |
| 748 ASSERT_NE(base::MemoryState::UNKNOWN, model()->GetMemoryState(row)); |
| 749 } |
| 750 |
| 708 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, DevToolsNewDockedWindow) { | 751 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, DevToolsNewDockedWindow) { |
| 709 ShowTaskManager(); // Task manager shown BEFORE dev tools window. | 752 ShowTaskManager(); // Task manager shown BEFORE dev tools window. |
| 710 | 753 |
| 711 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); | 754 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); |
| 712 DevToolsWindow* devtools = | 755 DevToolsWindow* devtools = |
| 713 DevToolsWindowTesting::OpenDevToolsWindowSync(browser(), true); | 756 DevToolsWindowTesting::OpenDevToolsWindowSync(browser(), true); |
| 714 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyTab())); | 757 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyTab())); |
| 715 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyTab())); | 758 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(2, MatchAnyTab())); |
| 716 DevToolsWindowTesting::CloseDevToolsWindowSync(devtools); | 759 DevToolsWindowTesting::CloseDevToolsWindowSync(devtools); |
| 717 } | 760 } |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1081 | 1124 |
| 1082 // Because the subframes for tab 2 are nested, their order is deterministic. | 1125 // Because the subframes for tab 2 are nested, their order is deterministic. |
| 1083 EXPECT_EQ("Subframe: http://a.com/", | 1126 EXPECT_EQ("Subframe: http://a.com/", |
| 1084 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 1))); | 1127 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 1))); |
| 1085 EXPECT_EQ("Subframe: http://c.com/", | 1128 EXPECT_EQ("Subframe: http://c.com/", |
| 1086 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 2))); | 1129 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 2))); |
| 1087 EXPECT_EQ("Subframe: http://b.com/", | 1130 EXPECT_EQ("Subframe: http://b.com/", |
| 1088 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 3))); | 1131 base::UTF16ToUTF8(model()->GetRowTitle(tab2_start + 3))); |
| 1089 } | 1132 } |
| 1090 } | 1133 } |
| OLD | NEW |