summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sanity_uitest.cc
blob: ab347bb7fb2c3af1dc80c89aa090844480a6fb46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// This is a file for random testcases that we run into that at one point or
// another have crashed the program.

#include "chrome/test/ui/ui_test.h"

#include "base/basictypes.h"
#include "base/file_path.h"
#include "base/platform_thread.h"
#include "chrome/common/chrome_switches.h"

class GoogleTest : public UITest {
 protected:
  GoogleTest() : UITest() {
    FilePath test_file(test_data_directory_);
    test_file = test_file.AppendASCII("google");
    test_file = test_file.AppendASCII("google.html");
    homepage_ = test_file.ToWStringHack();
  }
};

TEST_F(GoogleTest, Crash) {
  std::wstring page_title = L"Google";

  // Make sure the navigation succeeded.
  EXPECT_EQ(page_title, GetActiveTabTitle());

  // UITest will check if this crashed.
}

class ColumnLayout : public UITest {
 protected:
  ColumnLayout() : UITest() {
    FilePath test_file(test_data_directory_);
    test_file = test_file.AppendASCII("columns.html");
    homepage_ = test_file.ToWStringHack();
  }
};

TEST_F(ColumnLayout, Crash) {
  std::wstring page_title = L"Column test";

  // Make sure the navigation succeeded.
  EXPECT_EQ(page_title, GetActiveTabTitle());

  // UITest will check if this crashed.
}

// By passing kTryChromeAgain with a magic value > 10000 we cause chrome
// to exit fairly early. This was the cause of crashes. See bug 34799.
class EarlyReturnTest : public UITest {
 public:
  EarlyReturnTest() {
    wait_for_initial_loads_ = false;
    // We don't depend on these timeouts, they are set to the minimum so
    // the automation server waits the minimun amount possible for the
    // handshake that will never come.
    set_command_execution_timeout_ms(1);
    set_action_timeout_ms(1);
    launch_arguments_.AppendSwitchWithValue(switches::kTryChromeAgain, "10001");
  }
};

TEST_F(EarlyReturnTest, ToastCrasher) {
  // UITest will check if this crashed.
}