summaryrefslogtreecommitdiffstats
path: root/chrome/app/chrome_main_uitest.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-09 16:50:23 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-09 16:50:23 +0000
commitdedf2055a80cf9d869767bbd0c99f51e4f31260e (patch)
tree4ff02b6ef242a467d4db73c92ed1afec9a3fdabe /chrome/app/chrome_main_uitest.cc
parent1ef1c66a37fae2707f743c3588f88e893125b82f (diff)
downloadchromium_src-dedf2055a80cf9d869767bbd0c99f51e4f31260e.zip
chromium_src-dedf2055a80cf9d869767bbd0c99f51e4f31260e.tar.gz
chromium_src-dedf2055a80cf9d869767bbd0c99f51e4f31260e.tar.bz2
Add regression test for bug 7900 and necessary infrastructure.
The test simulates following scenario: user opens a local html page with Chrome when a browser instance is already running. The new Chrome process should notify the existing process about new page and exit. Bug 7900 broke this behavior causing the new process to crash. I verified that the ui_tests infrastructure would catch this crash and cause the test to fail. BUG=7900, 8056 Review URL: http://codereview.chromium.org/39257 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11247 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app/chrome_main_uitest.cc')
-rw-r--r--chrome/app/chrome_main_uitest.cc23
1 files changed, 22 insertions, 1 deletions
diff --git a/chrome/app/chrome_main_uitest.cc b/chrome/app/chrome_main_uitest.cc
index 41fd782..6038c9c 100644
--- a/chrome/app/chrome_main_uitest.cc
+++ b/chrome/app/chrome_main_uitest.cc
@@ -2,9 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/common/chrome_constants.h"
#include "chrome/test/ui/ui_test.h"
+#include "base/command_line.h"
+#include "base/file_path.h"
+#include "base/file_util.h"
+#include "net/base/net_util.h"
+
typedef UITest ChromeMainTest;
// Launch the app, then close the app.
@@ -44,3 +48,20 @@ TEST_F(ChromeMainTest, DISABLED_SecondLaunch) {
ASSERT_EQ(2, window_count);
}
+TEST_F(ChromeMainTest, ReuseBrowserInstanceWhenOpeningFile) {
+ include_testing_id_ = false;
+ use_existing_browser_ = true;
+
+ std::wstring test_file = test_data_directory_;
+ file_util::AppendToPath(&test_file, L"empty.html");
+
+ CommandLine command_line(L"");
+ command_line.AppendLooseValue(test_file);
+
+ LaunchBrowser(command_line, false);
+
+ FilePath test_file_path(FilePath::FromWStringHack(test_file));
+
+ ASSERT_TRUE(automation()->WaitForURLDisplayed(
+ net::FilePathToFileURL(test_file_path), action_timeout_ms()));
+}