summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/alert_apitest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/extensions/alert_apitest.cc')
-rw-r--r--chrome/browser/extensions/alert_apitest.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/chrome/browser/extensions/alert_apitest.cc b/chrome/browser/extensions/alert_apitest.cc
new file mode 100644
index 0000000..23e8fe8
--- /dev/null
+++ b/chrome/browser/extensions/alert_apitest.cc
@@ -0,0 +1,27 @@
+// Copyright (c) 2010 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.
+
+#include "chrome/browser/app_modal_dialog.h"
+#include "chrome/browser/browser.h"
+#include "chrome/browser/extensions/extension_apitest.h"
+#include "chrome/browser/extensions/extension_host.h"
+#include "chrome/browser/extensions/extension_process_manager.h"
+#include "chrome/browser/renderer_host/render_view_host.h"
+#include "chrome/browser/profile.h"
+#include "chrome/test/ui_test_utils.h"
+
+IN_PROC_BROWSER_TEST_F(ExtensionApiTest, AlertBasic) {
+ ASSERT_TRUE(RunExtensionTest("alert")) << message_;
+
+ Extension* extension = GetSingleLoadedExtension();
+ ExtensionHost* host = browser()->profile()->GetExtensionProcessManager()->
+ GetBackgroundHostForExtension(extension);
+ ASSERT_TRUE(host);
+ host->render_view_host()->ExecuteJavascriptInWebFrame(L"",
+ L"alert('This should not crash.');");
+
+ AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
+ ASSERT_TRUE(alert);
+ alert->CloseModalDialog();
+}