OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/task_manager/task_manager.h" | 5 #include "chrome/browser/task_manager/task_manager.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
33 #include "chrome/common/extensions/extension.h" | 33 #include "chrome/common/extensions/extension.h" |
34 #include "chrome/test/base/in_process_browser_test.h" | 34 #include "chrome/test/base/in_process_browser_test.h" |
35 #include "chrome/test/base/ui_test_utils.h" | 35 #include "chrome/test/base/ui_test_utils.h" |
36 #include "content/public/browser/notification_service.h" | 36 #include "content/public/browser/notification_service.h" |
37 #include "content/public/common/content_switches.h" | 37 #include "content/public/common/content_switches.h" |
38 #include "content/public/common/page_transition_types.h" | 38 #include "content/public/common/page_transition_types.h" |
39 #include "content/public/test/browser_test_utils.h" | 39 #include "content/public/test/browser_test_utils.h" |
40 #include "grit/generated_resources.h" | 40 #include "grit/generated_resources.h" |
41 #include "net/dns/mock_host_resolver.h" | 41 #include "net/dns/mock_host_resolver.h" |
| 42 #include "net/test/embedded_test_server/embedded_test_server.h" |
42 #include "testing/gtest/include/gtest/gtest.h" | 43 #include "testing/gtest/include/gtest/gtest.h" |
43 #include "ui/base/l10n/l10n_util.h" | 44 #include "ui/base/l10n/l10n_util.h" |
44 | 45 |
45 // http://crbug.com/31663 | 46 // http://crbug.com/31663 |
46 // TODO(linux_aura) http://crbug.com/163931 | 47 // TODO(linux_aura) http://crbug.com/163931 |
47 #if !(defined(OS_WIN) && defined(USE_AURA)) && !(defined(OS_LINUX) && !defined(O
S_CHROMEOS) && defined(USE_AURA)) | 48 #if !(defined(OS_WIN) && defined(USE_AURA)) && !(defined(OS_LINUX) && !defined(O
S_CHROMEOS) && defined(USE_AURA)) |
48 | 49 |
49 using content::WebContents; | 50 using content::WebContents; |
50 | 51 |
51 // On Linux this is crashing intermittently http://crbug/84719 | 52 // On Linux this is crashing intermittently http://crbug/84719 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 UnloadExtension(last_loaded_extension_id_); | 296 UnloadExtension(last_loaded_extension_id_); |
296 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1); | 297 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1); |
297 } | 298 } |
298 | 299 |
299 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeHostedAppTabs) { | 300 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeHostedAppTabs) { |
300 int resource_count = TaskManager::GetInstance()->model()->ResourceCount(); | 301 int resource_count = TaskManager::GetInstance()->model()->ResourceCount(); |
301 | 302 |
302 // The app under test acts on URLs whose host is "localhost", | 303 // The app under test acts on URLs whose host is "localhost", |
303 // so the URLs we navigate to must have host "localhost". | 304 // so the URLs we navigate to must have host "localhost". |
304 host_resolver()->AddRule("*", "127.0.0.1"); | 305 host_resolver()->AddRule("*", "127.0.0.1"); |
305 ASSERT_TRUE(test_server()->Start()); | 306 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
306 GURL::Replacements replace_host; | 307 GURL::Replacements replace_host; |
307 std::string host_str("localhost"); // must stay in scope with replace_host | 308 std::string host_str("localhost"); // must stay in scope with replace_host |
308 replace_host.SetHostStr(host_str); | 309 replace_host.SetHostStr(host_str); |
309 GURL base_url = test_server()->GetURL( | 310 GURL base_url = embedded_test_server()->GetURL( |
310 "files/extensions/api_test/app_process/"); | 311 "/extensions/api_test/app_process/"); |
311 base_url = base_url.ReplaceComponents(replace_host); | 312 base_url = base_url.ReplaceComponents(replace_host); |
312 | 313 |
313 // Open a new tab to an app URL before the app is loaded. | 314 // Open a new tab to an app URL before the app is loaded. |
314 GURL url(base_url.Resolve("path1/empty.html")); | 315 GURL url(base_url.Resolve("path1/empty.html")); |
315 content::WindowedNotificationObserver observer( | 316 content::WindowedNotificationObserver observer( |
316 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 317 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
317 content::NotificationService::AllSources()); | 318 content::NotificationService::AllSources()); |
318 AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); | 319 AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); |
319 observer.Wait(); | 320 observer.Wait(); |
320 | 321 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 ASSERT_TRUE(model()->GetV8Memory(resource_index, &result)); | 489 ASSERT_TRUE(model()->GetV8Memory(resource_index, &result)); |
489 LOG(INFO) << "Got V8 Heap Size " << result << " bytes"; | 490 LOG(INFO) << "Got V8 Heap Size " << result << " bytes"; |
490 EXPECT_GE(result, minimal_heap_size); | 491 EXPECT_GE(result, minimal_heap_size); |
491 | 492 |
492 ASSERT_TRUE(model()->GetV8MemoryUsed(resource_index, &result)); | 493 ASSERT_TRUE(model()->GetV8MemoryUsed(resource_index, &result)); |
493 LOG(INFO) << "Got V8 Used Heap Size " << result << " bytes"; | 494 LOG(INFO) << "Got V8 Used Heap Size " << result << " bytes"; |
494 EXPECT_GE(result, minimal_heap_size); | 495 EXPECT_GE(result, minimal_heap_size); |
495 } | 496 } |
496 | 497 |
497 #endif | 498 #endif |
OLD | NEW |