[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 | |||||
24 | TEST_F(GoogleTest, Crash) { | ||||
25 | std::wstring page_title = L"Google"; | ||||
26 | |||||
27 | // Make sure the navigation succeeded. | ||||
28 | EXPECT_EQ(page_title, GetActiveTabTitle()); | ||||
29 | |||||
30 | // UITest will check if this crashed. | ||||
31 | } | ||||
32 | |||||
33 | class ColumnLayout : public UITest { | ||||
34 | protected: | ||||
35 | ColumnLayout() : UITest() { | ||||
[email protected] | 95edc39 | 2010-07-30 22:00:38 | [diff] [blame] | 36 | FilePath test_file = test_data_directory_.AppendASCII("columns.html"); |
[email protected] | c405290f | 2011-01-08 02:04:59 | [diff] [blame^] | 37 | set_homepage(GURL(net::FilePathToFileURL(test_file)).spec()); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 38 | } |
39 | }; | ||||
40 | |||||
41 | TEST_F(ColumnLayout, Crash) { | ||||
42 | std::wstring page_title = L"Column test"; | ||||
43 | |||||
44 | // Make sure the navigation succeeded. | ||||
45 | EXPECT_EQ(page_title, GetActiveTabTitle()); | ||||
46 | |||||
[email protected] | 28de7d94 | 2010-02-23 01:43:04 | [diff] [blame] | 47 | // UITest will check if this crashed. |
48 | } | ||||
49 | |||||
[email protected] | 88ba0c04 | 2010-09-24 19:16:04 | [diff] [blame] | 50 | // By passing kTryChromeAgain with a magic value > 10000 we cause Chrome |
51 | // to exit fairly early. | ||||
52 | // Quickly exiting Chrome (regardless of this particular flag -- it | ||||
53 | // doesn't do anything other than cause Chrome to quit on startup on | ||||
54 | // non-Windows) was a cause of crashes (see bug 34799 for example) so | ||||
55 | // this is a useful test of the startup/quick-shutdown cycle. | ||||
[email protected] | 28de7d94 | 2010-02-23 01:43:04 | [diff] [blame] | 56 | class EarlyReturnTest : public UITest { |
57 | public: | ||||
58 | EarlyReturnTest() { | ||||
[email protected] | 88ba0c04 | 2010-09-24 19:16:04 | [diff] [blame] | 59 | wait_for_initial_loads_ = false; // Don't wait for any pages to load. |
[email protected] | 05076ba2 | 2010-07-30 05:59:57 | [diff] [blame] | 60 | launch_arguments_.AppendSwitchASCII(switches::kTryChromeAgain, "10001"); |
[email protected] | 28de7d94 | 2010-02-23 01:43:04 | [diff] [blame] | 61 | } |
62 | }; | ||||
63 | |||||
[email protected] | 88ba0c04 | 2010-09-24 19:16:04 | [diff] [blame] | 64 | // Disabled: http://crbug.com/45115 |
65 | // Due to limitations in our test infrastructure, this test currently doesn't | ||||
66 | // work. | ||||
67 | TEST_F(EarlyReturnTest, DISABLED_ToastCrasher) { | ||||
[email protected] | 28de7d94 | 2010-02-23 01:43:04 | [diff] [blame] | 68 | // UITest will check if this crashed. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 69 | } |