blob: cd02db27cbeb20ef1a03fb0d5da650620a80dc34 [file] [log] [blame]
[email protected]f214f8792011-01-01 02:17:081// Copyright (c) 2010 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit09911bf2008-07-26 23:55:294
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]4b68e0d2009-05-02 00:56:5711#include "base/file_path.h"
[email protected]28de7d942010-02-23 01:43:0412#include "chrome/common/chrome_switches.h"
[email protected]95edc392010-07-30 22:00:3813#include "net/base/net_util.h"
initial.commit09911bf2008-07-26 23:55:2914
15class GoogleTest : public UITest {
16 protected:
17 GoogleTest() : UITest() {
[email protected]95edc392010-07-30 22:00:3818 FilePath test_file =
19 test_data_directory_.AppendASCII("google").AppendASCII("google.html");
[email protected]c405290f2011-01-08 02:04:5920 set_homepage(GURL(net::FilePathToFileURL(test_file)).spec());
initial.commit09911bf2008-07-26 23:55:2921 }
22};
23
24TEST_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
33class ColumnLayout : public UITest {
34 protected:
35 ColumnLayout() : UITest() {
[email protected]95edc392010-07-30 22:00:3836 FilePath test_file = test_data_directory_.AppendASCII("columns.html");
[email protected]c405290f2011-01-08 02:04:5937 set_homepage(GURL(net::FilePathToFileURL(test_file)).spec());
initial.commit09911bf2008-07-26 23:55:2938 }
39};
40
41TEST_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]28de7d942010-02-23 01:43:0447 // UITest will check if this crashed.
48}
49
[email protected]88ba0c042010-09-24 19:16:0450// 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]28de7d942010-02-23 01:43:0456class EarlyReturnTest : public UITest {
57 public:
58 EarlyReturnTest() {
[email protected]88ba0c042010-09-24 19:16:0459 wait_for_initial_loads_ = false; // Don't wait for any pages to load.
[email protected]05076ba22010-07-30 05:59:5760 launch_arguments_.AppendSwitchASCII(switches::kTryChromeAgain, "10001");
[email protected]28de7d942010-02-23 01:43:0461 }
62};
63
[email protected]88ba0c042010-09-24 19:16:0464// Disabled: http://crbug.com/45115
65// Due to limitations in our test infrastructure, this test currently doesn't
66// work.
67TEST_F(EarlyReturnTest, DISABLED_ToastCrasher) {
[email protected]28de7d942010-02-23 01:43:0468 // UITest will check if this crashed.
initial.commit09911bf2008-07-26 23:55:2969}