Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / extensions / extension_install_ui_browsertest.cc
index 615584e..ba9fca2 100644 (file)
@@ -8,8 +8,6 @@
 #include "chrome/browser/chrome_notification_types.h"
 #include "chrome/browser/extensions/extension_browsertest.h"
 #include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/extension_sorting.h"
-#include "chrome/browser/infobars/confirm_infobar_delegate.h"
 #include "chrome/browser/infobars/infobar_service.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/themes/theme_service.h"
 #include "chrome/browser/ui/browser_finder.h"
 #include "chrome/browser/ui/tabs/tab_strip_model.h"
 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
+#include "chrome/common/extensions/extension_constants.h"
 #include "chrome/common/url_constants.h"
 #include "chrome/test/base/test_switches.h"
 #include "chrome/test/base/ui_test_utils.h"
+#include "components/infobars/core/confirm_infobar_delegate.h"
+#include "components/infobars/core/infobar.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/test/browser_test_utils.h"
+#include "extensions/browser/app_sorting.h"
+#include "extensions/browser/extension_prefs.h"
 #include "extensions/common/id_util.h"
 
 using content::WebContents;
+using extensions::AppSorting;
 using extensions::Extension;
 
 class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest {
@@ -41,7 +45,7 @@ class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest {
         InfoBarService::FromWebContents(web_contents);
     ASSERT_EQ(1U, infobar_service->infobar_count());
     ConfirmInfoBarDelegate* delegate =
-        infobar_service->infobar_at(0)->AsConfirmInfoBarDelegate();
+        infobar_service->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate();
     ASSERT_TRUE(delegate);
     delegate->Cancel();
     ASSERT_EQ(0U, infobar_service->infobar_count());
@@ -142,8 +146,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest,
   InstallThemeAndVerify("theme", "camo theme");
 }
 
+// TODO(samarth): remove along with NTP4 code.
 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest,
-                       AppInstallConfirmation) {
+                       DISABLED_AppInstallConfirmation) {
   int num_tabs = browser()->tab_strip_model()->count();
 
   base::FilePath app_dir = test_data_dir_.AppendASCII("app");
@@ -161,8 +166,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest,
   }
 }
 
+// TODO(samarth): remove along with NTP4 code.
 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest,
-                       AppInstallConfirmation_Incognito) {
+                       DISABLED_AppInstallConfirmation_Incognito) {
   Browser* incognito_browser = CreateIncognitoBrowser();
 
   int num_incognito_tabs = incognito_browser->tab_strip_model()->count();
@@ -194,7 +200,7 @@ class NewTabUISortingBrowserTest : public ExtensionInstallUIBrowserTest,
   virtual void Observe(int type,
                        const content::NotificationSource& source,
                        const content::NotificationDetails& details) OVERRIDE {
-    if (type != chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED) {
+    if (type != chrome::NOTIFICATION_APP_LAUNCHER_REORDERED) {
       observer_->Observe(type, source, details);
       return;
     }
@@ -211,12 +217,9 @@ class NewTabUISortingBrowserTest : public ExtensionInstallUIBrowserTest,
   DISALLOW_COPY_AND_ASSIGN(NewTabUISortingBrowserTest);
 };
 
-#if defined(OS_WIN)
-#define MAYBE_ReorderDuringInstall DISABLED_ReorderDuringInstall
-#else
-#define MAYBE_ReorderDuringInstall ReorderDuringInstall
-#endif
-IN_PROC_BROWSER_TEST_F(NewTabUISortingBrowserTest, MAYBE_ReorderDuringInstall) {
+// TODO(samarth): remove along with NTP4 code.
+IN_PROC_BROWSER_TEST_F(NewTabUISortingBrowserTest,
+                       DISABLED_ReorderDuringInstall) {
   ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL));
   ExtensionService* service = extensions::ExtensionSystem::Get(
       browser()->profile())->extension_service();
@@ -226,19 +229,20 @@ IN_PROC_BROWSER_TEST_F(NewTabUISortingBrowserTest, MAYBE_ReorderDuringInstall) {
   const extensions::Extension* webstore_extension =
       service->GetInstalledExtension(extension_misc::kWebStoreAppId);
   EXPECT_TRUE(webstore_extension);
-  ExtensionSorting* sorting = service->extension_prefs()->extension_sorting();
+  AppSorting* sorting =
+      extensions::ExtensionPrefs::Get(browser()->profile())->app_sorting();
 
   // Register for notifications in the same way as AppLauncherHandler.
-  registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED,
-      content::Source<ExtensionSorting>(sorting));
+  registrar_.Add(this,
+                 chrome::NOTIFICATION_APP_LAUNCHER_REORDERED,
+                 content::Source<AppSorting>(sorting));
   // ExtensionAppItem calls this when an app install starts.
   sorting->EnsureValidOrdinals(app_id, syncer::StringOrdinal());
   // Vefify the app is not actually installed yet.
   EXPECT_FALSE(service->GetInstalledExtension(app_id));
   // Move the test app from the end to be before the web store.
-  service->OnExtensionMoved(app_id,
-                            std::string(),
-                            extension_misc::kWebStoreAppId);
+  sorting->OnExtensionMoved(
+      app_id, std::string(), extension_misc::kWebStoreAppId);
   EXPECT_EQ(app_id, last_reordered_extension_id_);
 
   // Now install the app.