| 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/background/background_contents_service.h" | 10 #include "chrome/browser/background/background_contents_service.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "chrome/common/chrome_switches.h" | 34 #include "chrome/common/chrome_switches.h" |
| 35 #include "chrome/common/extensions/extension.h" | 35 #include "chrome/common/extensions/extension.h" |
| 36 #include "chrome/test/base/in_process_browser_test.h" | 36 #include "chrome/test/base/in_process_browser_test.h" |
| 37 #include "chrome/test/base/ui_test_utils.h" | 37 #include "chrome/test/base/ui_test_utils.h" |
| 38 #include "content/public/browser/notification_service.h" | 38 #include "content/public/browser/notification_service.h" |
| 39 #include "content/public/common/content_switches.h" | 39 #include "content/public/common/content_switches.h" |
| 40 #include "content/public/common/page_transition_types.h" | 40 #include "content/public/common/page_transition_types.h" |
| 41 #include "content/public/test/browser_test_utils.h" | 41 #include "content/public/test/browser_test_utils.h" |
| 42 #include "grit/generated_resources.h" | 42 #include "grit/generated_resources.h" |
| 43 #include "net/dns/mock_host_resolver.h" | 43 #include "net/dns/mock_host_resolver.h" |
| 44 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 44 #include "testing/gtest/include/gtest/gtest.h" | 45 #include "testing/gtest/include/gtest/gtest.h" |
| 45 #include "ui/base/l10n/l10n_util.h" | 46 #include "ui/base/l10n/l10n_util.h" |
| 46 | 47 |
| 47 // http://crbug.com/31663 | 48 // http://crbug.com/31663 |
| 48 // TODO(linux_aura) http://crbug.com/163931 | 49 // TODO(linux_aura) http://crbug.com/163931 |
| 49 #if !(defined(OS_WIN) && defined(USE_AURA)) && !(defined(OS_LINUX) && !defined(O
S_CHROMEOS) && defined(USE_AURA)) | 50 #if !(defined(OS_WIN) && defined(USE_AURA)) && !(defined(OS_LINUX) && !defined(O
S_CHROMEOS) && defined(USE_AURA)) |
| 50 | 51 |
| 51 using content::WebContents; | 52 using content::WebContents; |
| 52 | 53 |
| 53 // On Linux this is crashing intermittently http://crbug/84719 | 54 // On Linux this is crashing intermittently http://crbug/84719 |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 UnloadExtension(last_loaded_extension_id_); | 375 UnloadExtension(last_loaded_extension_id_); |
| 375 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1); | 376 TaskManagerBrowserTestUtil::WaitForWebResourceChange(1); |
| 376 } | 377 } |
| 377 | 378 |
| 378 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeHostedAppTabs) { | 379 IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeHostedAppTabs) { |
| 379 int resource_count = TaskManager::GetInstance()->model()->ResourceCount(); | 380 int resource_count = TaskManager::GetInstance()->model()->ResourceCount(); |
| 380 | 381 |
| 381 // The app under test acts on URLs whose host is "localhost", | 382 // The app under test acts on URLs whose host is "localhost", |
| 382 // so the URLs we navigate to must have host "localhost". | 383 // so the URLs we navigate to must have host "localhost". |
| 383 host_resolver()->AddRule("*", "127.0.0.1"); | 384 host_resolver()->AddRule("*", "127.0.0.1"); |
| 384 ASSERT_TRUE(test_server()->Start()); | 385 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 385 GURL::Replacements replace_host; | 386 GURL::Replacements replace_host; |
| 386 std::string host_str("localhost"); // must stay in scope with replace_host | 387 std::string host_str("localhost"); // must stay in scope with replace_host |
| 387 replace_host.SetHostStr(host_str); | 388 replace_host.SetHostStr(host_str); |
| 388 GURL base_url = test_server()->GetURL( | 389 GURL base_url = embedded_test_server()->GetURL( |
| 389 "files/extensions/api_test/app_process/"); | 390 "/extensions/api_test/app_process/"); |
| 390 base_url = base_url.ReplaceComponents(replace_host); | 391 base_url = base_url.ReplaceComponents(replace_host); |
| 391 | 392 |
| 392 // Open a new tab to an app URL before the app is loaded. | 393 // Open a new tab to an app URL before the app is loaded. |
| 393 GURL url(base_url.Resolve("path1/empty.html")); | 394 GURL url(base_url.Resolve("path1/empty.html")); |
| 394 content::WindowedNotificationObserver observer( | 395 content::WindowedNotificationObserver observer( |
| 395 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 396 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 396 content::NotificationService::AllSources()); | 397 content::NotificationService::AllSources()); |
| 397 AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); | 398 AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); |
| 398 observer.Wait(); | 399 observer.Wait(); |
| 399 | 400 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 ASSERT_TRUE(model()->GetV8Memory(resource_index, &result)); | 589 ASSERT_TRUE(model()->GetV8Memory(resource_index, &result)); |
| 589 LOG(INFO) << "Got V8 Heap Size " << result << " bytes"; | 590 LOG(INFO) << "Got V8 Heap Size " << result << " bytes"; |
| 590 EXPECT_GE(result, minimal_heap_size); | 591 EXPECT_GE(result, minimal_heap_size); |
| 591 | 592 |
| 592 ASSERT_TRUE(model()->GetV8MemoryUsed(resource_index, &result)); | 593 ASSERT_TRUE(model()->GetV8MemoryUsed(resource_index, &result)); |
| 593 LOG(INFO) << "Got V8 Used Heap Size " << result << " bytes"; | 594 LOG(INFO) << "Got V8 Used Heap Size " << result << " bytes"; |
| 594 EXPECT_GE(result, minimal_heap_size); | 595 EXPECT_GE(result, minimal_heap_size); |
| 595 } | 596 } |
| 596 | 597 |
| 597 #endif | 598 #endif |
| OLD | NEW |