Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: chrome/browser/extensions/webstore_inline_install_browsertest.cc

Issue 7621032: Initial inline web store install bindings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review feedback. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/extensions_ui.cc ('k') | chrome/browser/ui/webui/ntp/ntp_resource_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/webstore_inline_install_browsertest.cc
diff --git a/chrome/browser/extensions/webstore_inline_install_browsertest.cc b/chrome/browser/extensions/webstore_inline_install_browsertest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b76f18e352b6a93454e02e2b469c00b215c5b71e
--- /dev/null
+++ b/chrome/browser/extensions/webstore_inline_install_browsertest.cc
@@ -0,0 +1,72 @@
+// Copyright (c) 2011 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 "base/command_line.h"
+#include "chrome/browser/extensions/extension_host.h"
+#include "chrome/browser/tabs/tab_strip_model.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome/test/base/in_process_browser_test.h"
+#include "chrome/test/base/ui_test_utils.h"
+#include "content/browser/tab_contents/tab_contents.h"
+#include "content/common/content_notification_types.h"
+#include "googleurl/src/gurl.h"
+#include "net/base/mock_host_resolver.h"
+
+class WebstoreInlineInstallTest : public InProcessBrowserTest {
+ public:
+ virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
+ EnableDOMAutomation();
+
+ InProcessBrowserTest::SetUpCommandLine(command_line);
+ command_line->AppendSwitchASCII(
+ switches::kAppsGalleryURL, "http://cws.com");
+ command_line->AppendSwitch(switches::kEnableInlineWebstoreInstall);
+ }
+
+ virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
+ host_resolver()->AddRule("cws.com", "127.0.0.1");
+ host_resolver()->AddRule("app.com", "127.0.0.1");
+ ASSERT_TRUE(test_server()->Start());
+ }
+
+ protected:
+ GURL GetPageUrl(const std::string& page_filename) {
+ GURL page_url = test_server()->GetURL(
+ "files/extensions/api_test/webstore_inline_install/" + page_filename);
+
+ GURL::Replacements replace_host;
+ std::string host_str("app.com");
+ replace_host.SetHostStr(host_str);
+ return page_url.ReplaceComponents(replace_host);
+ }
+};
+
+IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallTest, Install) {
+ ui_test_utils::NavigateToURL(browser(), GetPageUrl("install.html"));
+
+ bool result = false;
+ ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
+ browser()->GetSelectedTabContents()->render_view_host(), L"",
+ L"runTest()", &result));
+ EXPECT_TRUE(result);
+
+ // The "inline" UI right now is just the store entry in a new tab.
+ if (browser()->tabstrip_model()->count() == 1) {
+ ui_test_utils::WaitForNewTab(browser());
+ }
+
+ TabContents* tab_contents = browser()->GetSelectedTabContents();
+ EXPECT_EQ(GURL("http://cws.com/detail/abc"), tab_contents->GetURL());
+}
+
+IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallTest, FindLink) {
+ ui_test_utils::NavigateToURL(browser(), GetPageUrl("find_link.html"));
+
+ bool result = false;
+ ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
+ browser()->GetSelectedTabContents()->render_view_host(), L"",
+ L"runTest()", &result));
+ EXPECT_TRUE(result);
+}
« no previous file with comments | « chrome/browser/extensions/extensions_ui.cc ('k') | chrome/browser/ui/webui/ntp/ntp_resource_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698