| 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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 const std::string time1 = "12985807272597591"; | 667 const std::string time1 = "12985807272597591"; |
| 668 const std::string time2 = "12985807272599918"; | 668 const std::string time2 = "12985807272599918"; |
| 669 | 669 |
| 670 // Initialize the database. | 670 // Initialize the database. |
| 671 AddStateValue(kStateProfilePrefix + first_profile_name_, time1); | 671 AddStateValue(kStateProfilePrefix + first_profile_name_, time1); |
| 672 AddStateValue(kStateProfilePrefix + second_profile_name_, time2); | 672 AddStateValue(kStateProfilePrefix + second_profile_name_, time2); |
| 673 | 673 |
| 674 performance_monitor()->CheckForUncleanExits(); | 674 performance_monitor()->CheckForUncleanExits(); |
| 675 content::RunAllPendingInMessageLoop(); | 675 content::RunAllPendingInMessageLoop(); |
| 676 | 676 |
| 677 // Load the second profile, which has also exited uncleanly. | 677 // Load the second profile, which has also exited uncleanly. Note that since |
| 678 // the second profile is new, component extensions will be installed as part |
| 679 // of the browser startup for that profile, generating extra events. |
| 678 g_browser_process->profile_manager()->GetProfile(second_profile_path); | 680 g_browser_process->profile_manager()->GetProfile(second_profile_path); |
| 679 content::RunAllPendingInMessageLoop(); | 681 content::RunAllPendingInMessageLoop(); |
| 680 | 682 |
| 681 Database::EventVector events = GetEvents(); | 683 Database::EventVector events = GetEvents(); |
| 682 | 684 |
| 683 const size_t kNumEvents = 2; | 685 const size_t kNumUncleanExitEvents = 2; |
| 684 ASSERT_EQ(kNumEvents, events.size()); | 686 size_t num_unclean_exit_events = 0; |
| 685 CheckEventType(EVENT_UNCLEAN_EXIT, events[0]); | 687 for (size_t i = 0; i < events.size(); ++i) { |
| 686 CheckEventType(EVENT_UNCLEAN_EXIT, events[1]); | 688 int event_type = -1; |
| 689 if (events[i]->data()->GetInteger("eventType", &event_type) && |
| 690 event_type == EVENT_EXTENSION_INSTALL) { |
| 691 continue; |
| 692 } |
| 693 CheckEventType(EVENT_UNCLEAN_EXIT, events[i]); |
| 694 ++num_unclean_exit_events; |
| 695 } |
| 696 ASSERT_EQ(kNumUncleanExitEvents, num_unclean_exit_events); |
| 687 | 697 |
| 688 std::string event_profile; | 698 std::string event_profile; |
| 689 ASSERT_TRUE(events[0]->data()->GetString("profileName", &event_profile)); | 699 ASSERT_TRUE(events[0]->data()->GetString("profileName", &event_profile)); |
| 690 ASSERT_EQ(first_profile_name_, event_profile); | 700 ASSERT_EQ(first_profile_name_, event_profile); |
| 691 | 701 |
| 692 ASSERT_TRUE(events[1]->data()->GetString("profileName", &event_profile)); | 702 ASSERT_TRUE(events[1]->data()->GetString("profileName", &event_profile)); |
| 693 ASSERT_EQ(second_profile_name_, event_profile); | 703 ASSERT_EQ(second_profile_name_, event_profile); |
| 694 } | 704 } |
| 695 | 705 |
| 696 IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, StartupTime) { | 706 IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, StartupTime) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 test_server()->GetURL(std::string("files/").append("title2.html"))); | 784 test_server()->GetURL(std::string("files/").append("title2.html"))); |
| 775 | 785 |
| 776 performance_monitor()->DoTimedCollections(); | 786 performance_monitor()->DoTimedCollections(); |
| 777 | 787 |
| 778 metrics = GetStats(METRIC_NETWORK_BYTES_READ); | 788 metrics = GetStats(METRIC_NETWORK_BYTES_READ); |
| 779 ASSERT_EQ(2u, metrics.size()); | 789 ASSERT_EQ(2u, metrics.size()); |
| 780 EXPECT_GE(metrics[1].value, page1_size + page2_size); | 790 EXPECT_GE(metrics[1].value, page1_size + page2_size); |
| 781 } | 791 } |
| 782 | 792 |
| 783 } // namespace performance_monitor | 793 } // namespace performance_monitor |
| OLD | NEW |