Merge Chromium at r66597: Initial merge by git.

Change-Id: I9639f8a997f90ec219573aa22a49f5dbde78cc7b
diff --git a/chrome/browser/extensions/extension_gallery_install_apitest.cc b/chrome/browser/extensions/extension_gallery_install_apitest.cc
index cf10ed4..820d9ef 100644
--- a/chrome/browser/extensions/extension_gallery_install_apitest.cc
+++ b/chrome/browser/extensions/extension_gallery_install_apitest.cc
@@ -16,6 +16,22 @@
     command_line->AppendSwitchASCII(switches::kAppsGalleryURL,
         "http://www.example.com");
   }
+
+  bool RunInstallTest(const std::string& page) {
+    std::string base_url = base::StringPrintf(
+        "http://www.example.com:%u/files/extensions/",
+        test_server()->host_port_pair().port());
+
+    std::string testing_install_base_url = base_url;
+    testing_install_base_url += "good.crx";
+    CompleteInstallFunction::SetTestingInstallBaseUrl(
+        testing_install_base_url.c_str());
+
+    std::string page_url = base_url;
+    page_url += "api_test/extension_gallery_install/" + page;
+
+    return RunPageTest(page_url.c_str());
+  }
 };
 
 // http://crbug.com/55642 - failing on XP.
@@ -29,15 +45,11 @@
   host_resolver()->AddRule("www.example.com", "127.0.0.1");
   ASSERT_TRUE(test_server()->Start());
 
-  std::string base_url = base::StringPrintf(
-      "http://www.example.com:%u/files/extensions/",
-      test_server()->host_port_pair().port());
+  BeginInstallFunction::SetIgnoreUserGestureForTests(true);
+  ASSERT_TRUE(RunInstallTest("test.html"));
+  ASSERT_TRUE(RunInstallTest("complete_without_begin.html"));
+  ASSERT_TRUE(RunInstallTest("invalid_begin.html"));
 
-  std::string testing_install_base_url = base_url;
-  testing_install_base_url += "good.crx";
-  InstallFunction::SetTestingInstallBaseUrl(testing_install_base_url.c_str());
-
-  std::string page_url = base_url;
-  page_url += "api_test/extension_gallery_install/test.html";
-  ASSERT_TRUE(RunPageTest(page_url.c_str()));
+  BeginInstallFunction::SetIgnoreUserGestureForTests(false);
+  ASSERT_TRUE(RunInstallTest("no_user_gesture.html"));
 }