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/test/base/in_process_browser_test.h" | 5 #include "chrome/test/base/in_process_browser_test.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
11 #include "chrome/browser/performance_monitor/constants.h" | 11 #include "chrome/browser/performance_monitor/constants.h" |
12 #include "chrome/browser/performance_monitor/database.h" | 12 #include "chrome/browser/performance_monitor/database.h" |
13 #include "chrome/browser/performance_monitor/performance_monitor.h" | 13 #include "chrome/browser/performance_monitor/performance_monitor.h" |
14 #include "chrome/browser/extensions/extension_browsertest.h" | 14 #include "chrome/browser/extensions/extension_browsertest.h" |
15 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
16 #include "chrome/browser/extensions/unpacked_installer.h" | 16 #include "chrome/browser/extensions/unpacked_installer.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/browser_tabstrip.h" | 19 #include "chrome/browser/ui/browser_tabstrip.h" |
20 #include "chrome/common/chrome_notification_types.h" | 20 #include "chrome/common/chrome_notification_types.h" |
21 #include "chrome/common/chrome_paths.h" | 21 #include "chrome/common/chrome_paths.h" |
22 #include "chrome/common/chrome_version_info.h" | 22 #include "chrome/common/chrome_version_info.h" |
23 #include "chrome/common/extensions/extension.h" | 23 #include "chrome/common/extensions/extension.h" |
24 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
25 #include "chrome/test/base/ui_test_utils.h" | 25 #include "chrome/test/base/ui_test_utils.h" |
26 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
27 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
| 28 #include "content/public/test/browser_test_utils.h" |
28 | 29 |
29 using extensions::Extension; | 30 using extensions::Extension; |
30 using performance_monitor::Event; | 31 using performance_monitor::Event; |
31 | 32 |
32 namespace { | 33 namespace { |
33 // Helper struct to store the information of an extension; this is needed if the | 34 // Helper struct to store the information of an extension; this is needed if the |
34 // pointer to the extension ever becomes invalid (e.g., if we uninstall the | 35 // pointer to the extension ever becomes invalid (e.g., if we uninstall the |
35 // extension). | 36 // extension). |
36 struct ExtensionBasicInfo { | 37 struct ExtensionBasicInfo { |
37 // Empty constructor for stl-container-happiness. | 38 // Empty constructor for stl-container-happiness. |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 ASSERT_TRUE(value->GetString("currentVersion", ¤t_version)); | 395 ASSERT_TRUE(value->GetString("currentVersion", ¤t_version)); |
395 ASSERT_EQ(version_string, current_version); | 396 ASSERT_EQ(version_string, current_version); |
396 } | 397 } |
397 | 398 |
398 #if !defined(OS_WIN) | 399 #if !defined(OS_WIN) |
399 // Disabled on Windows due to a bug where Windows will return a normal exit | 400 // Disabled on Windows due to a bug where Windows will return a normal exit |
400 // code in the testing environment, even if the process died (this is not the | 401 // code in the testing environment, even if the process died (this is not the |
401 // case when hand-testing). This code can be traced to MSDN functions in | 402 // case when hand-testing). This code can be traced to MSDN functions in |
402 // base::GetTerminationStatus(), so there's not much we can do. | 403 // base::GetTerminationStatus(), so there's not much we can do. |
403 IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, KilledByOSEvent) { | 404 IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, KilledByOSEvent) { |
404 ui_test_utils::CrashTab(chrome::GetActiveWebContents(browser())); | 405 content::CrashTab(chrome::GetActiveWebContents(browser())); |
405 | 406 |
406 std::vector<linked_ptr<Event> > events = GetEvents(); | 407 std::vector<linked_ptr<Event> > events = GetEvents(); |
407 | 408 |
408 ASSERT_EQ(1u, events.size()); | 409 ASSERT_EQ(1u, events.size()); |
409 CheckEventType(EVENT_KILLED_BY_OS_CRASH, events[0]); | 410 CheckEventType(EVENT_KILLED_BY_OS_CRASH, events[0]); |
410 } | 411 } |
411 #endif // !defined(OS_WIN) | 412 #endif // !defined(OS_WIN) |
412 | 413 |
413 IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, | 414 IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, |
414 DISABLED_RendererCrashEvent) { | 415 DISABLED_RendererCrashEvent) { |
415 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUICrashURL)); | 416 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUICrashURL)); |
416 | 417 |
417 std::vector<linked_ptr<Event> > events = GetEvents(); | 418 std::vector<linked_ptr<Event> > events = GetEvents(); |
418 ASSERT_EQ(1u, events.size()); | 419 ASSERT_EQ(1u, events.size()); |
419 | 420 |
420 CheckEventType(EVENT_RENDERER_CRASH, events[0]); | 421 CheckEventType(EVENT_RENDERER_CRASH, events[0]); |
421 } | 422 } |
422 | 423 |
423 } // namespace performance_monitor | 424 } // namespace performance_monitor |
OLD | NEW |