[email protected] | f214f879 | 2011-01-01 02:17:08 | [diff] [blame] | 1 | // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 4 | |
5 | // This is a file for random testcases that we run into that at one point or | ||||
6 | // another have crashed the program. | ||||
7 | |||||
8 | #include "chrome/test/ui/ui_test.h" | ||||
9 | |||||
10 | #include "base/basictypes.h" | ||||
[email protected] | 4b68e0d | 2009-05-02 00:56:57 | [diff] [blame] | 11 | #include "base/file_path.h" |
[email protected] | 28de7d94 | 2010-02-23 01:43:04 | [diff] [blame] | 12 | #include "chrome/common/chrome_switches.h" |
[email protected] | 95edc39 | 2010-07-30 22:00:38 | [diff] [blame] | 13 | #include "net/base/net_util.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 14 | |
15 | class GoogleTest : public UITest { | ||||
16 | protected: | ||||
17 | GoogleTest() : UITest() { | ||||
[email protected] | 95edc39 | 2010-07-30 22:00:38 | [diff] [blame] | 18 | FilePath test_file = |
19 | test_data_directory_.AppendASCII("google").AppendASCII("google.html"); | ||||
[email protected] | c405290f | 2011-01-08 02:04:59 | [diff] [blame] | 20 | set_homepage(GURL(net::FilePathToFileURL(test_file)).spec()); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 21 | } |
22 | }; | ||||
23 | |||||
[email protected] | dba2510 | 2011-06-12 21:01:58 | [diff] [blame^] | 24 | // Flakily fails under Valgrind, see http://crbug.com/85863. |
25 | #if defined(OS_MACOSX) | ||||
26 | #define MAYBE_Crash FLAKY_Crash | ||||
27 | #else | ||||
28 | #define MAYBE_Crash Crash | ||||
29 | #endif // defined(OS_MACOSX) | ||||
30 | TEST_F(GoogleTest, MAYBE_Crash) { | ||||
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 31 | std::wstring page_title = L"Google"; |
32 | |||||
33 | // Make sure the navigation succeeded. | ||||
34 | EXPECT_EQ(page_title, GetActiveTabTitle()); | ||||
35 | |||||
36 | // UITest will check if this crashed. | ||||
37 | } | ||||
38 | |||||
39 | class ColumnLayout : public UITest { | ||||
40 | protected: | ||||
41 | ColumnLayout() : UITest() { | ||||
[email protected] | 95edc39 | 2010-07-30 22:00:38 | [diff] [blame] | 42 | FilePath test_file = test_data_directory_.AppendASCII("columns.html"); |
[email protected] | c405290f | 2011-01-08 02:04:59 | [diff] [blame] | 43 | set_homepage(GURL(net::FilePathToFileURL(test_file)).spec()); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 44 | } |
45 | }; | ||||
46 | |||||
[email protected] | dba2510 | 2011-06-12 21:01:58 | [diff] [blame^] | 47 | // Flakily fails under Valgrind, see http://crbug.com/85863. |
48 | TEST_F(ColumnLayout, MAYBE_Crash) { | ||||
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 49 | std::wstring page_title = L"Column test"; |
50 | |||||
51 | // Make sure the navigation succeeded. | ||||
52 | EXPECT_EQ(page_title, GetActiveTabTitle()); | ||||
53 | |||||
[email protected] | 28de7d94 | 2010-02-23 01:43:04 | [diff] [blame] | 54 | // UITest will check if this crashed. |
55 | } | ||||
56 | |||||
[email protected] | 88ba0c04 | 2010-09-24 19:16:04 | [diff] [blame] | 57 | // By passing kTryChromeAgain with a magic value > 10000 we cause Chrome |
58 | // to exit fairly early. | ||||
59 | // Quickly exiting Chrome (regardless of this particular flag -- it | ||||
60 | // doesn't do anything other than cause Chrome to quit on startup on | ||||
61 | // non-Windows) was a cause of crashes (see bug 34799 for example) so | ||||
62 | // this is a useful test of the startup/quick-shutdown cycle. | ||||
[email protected] | 28de7d94 | 2010-02-23 01:43:04 | [diff] [blame] | 63 | class EarlyReturnTest : public UITest { |
64 | public: | ||||
65 | EarlyReturnTest() { | ||||
[email protected] | 88ba0c04 | 2010-09-24 19:16:04 | [diff] [blame] | 66 | wait_for_initial_loads_ = false; // Don't wait for any pages to load. |
[email protected] | 05076ba2 | 2010-07-30 05:59:57 | [diff] [blame] | 67 | launch_arguments_.AppendSwitchASCII(switches::kTryChromeAgain, "10001"); |
[email protected] | 28de7d94 | 2010-02-23 01:43:04 | [diff] [blame] | 68 | } |
69 | }; | ||||
70 | |||||
[email protected] | 88ba0c04 | 2010-09-24 19:16:04 | [diff] [blame] | 71 | // Disabled: http://crbug.com/45115 |
72 | // Due to limitations in our test infrastructure, this test currently doesn't | ||||
73 | // work. | ||||
74 | TEST_F(EarlyReturnTest, DISABLED_ToastCrasher) { | ||||
[email protected] | 28de7d94 | 2010-02-23 01:43:04 | [diff] [blame] | 75 | // UITest will check if this crashed. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 76 | } |