1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
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"
11 #include "base/file_path.h"
12 #include "chrome/common/chrome_switches.h"
13 #include "net/base/net_util.h"
14
15 class GoogleTest : public UITest {
16 protected:
GoogleTest()17 GoogleTest() : UITest() {
18 FilePath test_file =
19 test_data_directory_.AppendASCII("google").AppendASCII("google.html");
20 set_homepage(GURL(net::FilePathToFileURL(test_file)).spec());
21 }
22 };
23
TEST_F(GoogleTest,Crash)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:
ColumnLayout()35 ColumnLayout() : UITest() {
36 FilePath test_file = test_data_directory_.AppendASCII("columns.html");
37 set_homepage(GURL(net::FilePathToFileURL(test_file)).spec());
38 }
39 };
40
TEST_F(ColumnLayout,Crash)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
47 // UITest will check if this crashed.
48 }
49
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.
56 class EarlyReturnTest : public UITest {
57 public:
EarlyReturnTest()58 EarlyReturnTest() {
59 wait_for_initial_loads_ = false; // Don't wait for any pages to load.
60 launch_arguments_.AppendSwitchASCII(switches::kTryChromeAgain, "10001");
61 }
62 };
63
64 // Disabled: http://crbug.com/45115
65 // Due to limitations in our test infrastructure, this test currently doesn't
66 // work.
TEST_F(EarlyReturnTest,DISABLED_ToastCrasher)67 TEST_F(EarlyReturnTest, DISABLED_ToastCrasher) {
68 // UITest will check if this crashed.
69 }
70