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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 stats = GetStats(METRIC_SHARED_MEMORY_USAGE); | 590 stats = GetStats(METRIC_SHARED_MEMORY_USAGE); |
591 ASSERT_EQ(2u, stats.size()); | 591 ASSERT_EQ(2u, stats.size()); |
592 EXPECT_GT(stats[1].value, 0); | 592 EXPECT_GT(stats[1].value, 0); |
593 } | 593 } |
594 | 594 |
595 #if !defined(OS_WIN) | 595 #if !defined(OS_WIN) |
596 // Disabled on Windows due to a bug where Windows will return a normal exit | 596 // Disabled on Windows due to a bug where Windows will return a normal exit |
597 // code in the testing environment, even if the process died (this is not the | 597 // code in the testing environment, even if the process died (this is not the |
598 // case when hand-testing). This code can be traced to MSDN functions in | 598 // case when hand-testing). This code can be traced to MSDN functions in |
599 // base::GetTerminationStatus(), so there's not much we can do. | 599 // base::GetTerminationStatus(), so there's not much we can do. |
600 IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, KilledByOSEvent) { | 600 IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, RendererKilledEvent) { |
601 content::CrashTab(chrome::GetActiveWebContents(browser())); | 601 content::CrashTab(chrome::GetActiveWebContents(browser())); |
602 | 602 |
603 Database::EventVector events = GetEvents(); | 603 Database::EventVector events = GetEvents(); |
604 | 604 |
605 ASSERT_EQ(1u, events.size()); | 605 ASSERT_EQ(1u, events.size()); |
606 CheckEventType(EVENT_KILLED_BY_OS_CRASH, events[0]); | 606 CheckEventType(EVENT_RENDERER_KILLED, events[0]); |
| 607 |
| 608 // Check the url - since we never went anywhere, this should be about:blank. |
| 609 std::string url; |
| 610 ASSERT_TRUE(events[0]->data()->GetString("url", &url)); |
| 611 ASSERT_EQ("about:blank", url); |
607 } | 612 } |
608 #endif // !defined(OS_WIN) | 613 #endif // !defined(OS_WIN) |
609 | 614 |
610 IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, RendererCrashEvent) { | 615 IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, RendererCrashEvent) { |
611 content::WindowedNotificationObserver windowed_observer( | 616 content::WindowedNotificationObserver windowed_observer( |
612 content::NOTIFICATION_RENDERER_PROCESS_CLOSED, | 617 content::NOTIFICATION_RENDERER_PROCESS_CLOSED, |
613 content::NotificationService::AllSources()); | 618 content::NotificationService::AllSources()); |
614 | 619 |
615 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUICrashURL)); | 620 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUICrashURL)); |
616 | 621 |
617 windowed_observer.Wait(); | 622 windowed_observer.Wait(); |
618 | 623 |
619 Database::EventVector events = GetEvents(); | 624 Database::EventVector events = GetEvents(); |
620 ASSERT_EQ(1u, events.size()); | 625 ASSERT_EQ(1u, events.size()); |
621 | 626 |
622 CheckEventType(EVENT_RENDERER_CRASH, events[0]); | 627 CheckEventType(EVENT_RENDERER_CRASH, events[0]); |
| 628 |
| 629 std::string url; |
| 630 ASSERT_TRUE(events[0]->data()->GetString("url", &url)); |
| 631 ASSERT_EQ("chrome://crash/", url); |
623 } | 632 } |
624 | 633 |
625 IN_PROC_BROWSER_TEST_F(PerformanceMonitorUncleanExitBrowserTest, | 634 IN_PROC_BROWSER_TEST_F(PerformanceMonitorUncleanExitBrowserTest, |
626 OneProfileUncleanExit) { | 635 OneProfileUncleanExit) { |
627 // Initialize the database value (if there's no value in the database, it | 636 // Initialize the database value (if there's no value in the database, it |
628 // can't determine the last active time of the profile, and doesn't insert | 637 // can't determine the last active time of the profile, and doesn't insert |
629 // the event). | 638 // the event). |
630 const std::string time = "12985807272597591"; | 639 const std::string time = "12985807272597591"; |
631 AddStateValue(kStateProfilePrefix + first_profile_name_, time); | 640 AddStateValue(kStateProfilePrefix + first_profile_name_, time); |
632 | 641 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 test_server()->GetURL(std::string("files/").append("title2.html"))); | 770 test_server()->GetURL(std::string("files/").append("title2.html"))); |
762 | 771 |
763 performance_monitor()->DoTimedCollections(); | 772 performance_monitor()->DoTimedCollections(); |
764 | 773 |
765 metrics = GetStats(METRIC_NETWORK_BYTES_READ); | 774 metrics = GetStats(METRIC_NETWORK_BYTES_READ); |
766 ASSERT_EQ(2u, metrics.size()); | 775 ASSERT_EQ(2u, metrics.size()); |
767 EXPECT_GE(metrics[1].value, page1_size + page2_size); | 776 EXPECT_GE(metrics[1].value, page1_size + page2_size); |
768 } | 777 } |
769 | 778 |
770 } // namespace performance_monitor | 779 } // namespace performance_monitor |
OLD | NEW |