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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/command_line.h"
6 #include "chrome/browser/extensions/extension_host.h"
7 #include "chrome/browser/tabs/tab_strip_model.h"
8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/common/chrome_switches.h"
10 #include "chrome/test/base/in_process_browser_test.h"
11 #include "chrome/test/base/ui_test_utils.h"
12 #include "content/browser/tab_contents/tab_contents.h"
13 #include "content/common/content_notification_types.h"
14 #include "googleurl/src/gurl.h"
15 #include "net/base/mock_host_resolver.h"
16
17 class WebstoreInlineInstallTest : public InProcessBrowserTest {
18 public:
19 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
20 EnableDOMAutomation();
21
22 InProcessBrowserTest::SetUpCommandLine(command_line);
23 command_line->AppendSwitchASCII(
24 switches::kAppsGalleryURL, "http://cws.com");
25 command_line->AppendSwitch(switches::kEnableInlineWebstoreInstall);
26 }
27
28 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
29 host_resolver()->AddRule("cws.com", "127.0.0.1");
30 host_resolver()->AddRule("app.com", "127.0.0.1");
31 ASSERT_TRUE(test_server()->Start());
32 }
33
34 protected:
35 GURL GetPageUrl(const std::string& page_filename) {
36 GURL page_url = test_server()->GetURL(
37 "files/extensions/api_test/webstore_inline_install/" + page_filename);
38
39 GURL::Replacements replace_host;
40 std::string host_str("app.com");
41 replace_host.SetHostStr(host_str);
42 return page_url.ReplaceComponents(replace_host);
43 }
44 };
45
46 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallTest, Install) {
47 ui_test_utils::NavigateToURL(browser(), GetPageUrl("install.html"));
48
49 bool result = false;
50 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
51 browser()->GetSelectedTabContents()->render_view_host(), L"",
52 L"runTest()", &result));
53 EXPECT_TRUE(result);
54
55 // The "inline" UI right now is just the store entry in a new tab.
56 if (browser()->tabstrip_model()->count() == 1) {
57 ui_test_utils::WaitForNewTab(browser());
58 }
59
60 TabContents* tab_contents = browser()->GetSelectedTabContents();
61 EXPECT_EQ(GURL("http://cws.com/detail/abc"), tab_contents->GetURL());
62 }
63
64 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallTest, FindLink) {
65 ui_test_utils::NavigateToURL(browser(), GetPageUrl("find_link.html"));
66
67 bool result = false;
68 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
69 browser()->GetSelectedTabContents()->render_view_host(), L"",
70 L"runTest()", &result));
71 EXPECT_TRUE(result);
72 }
OLDNEW
« 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