Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / sync / profile_signin_confirmation_helper_unittest.cc
index 99056df..5a37889 100644 (file)
 #include "base/strings/string16.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/bookmarks/bookmark_model.h"
 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
-#include "chrome/browser/bookmarks/bookmark_test_helpers.h"
-#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/test_extension_system.h"
 #include "chrome/browser/history/history_service.h"
 #include "chrome/browser/history/history_service_factory.h"
 #include "chrome/browser/prefs/browser_prefs.h"
-#include "chrome/common/extensions/extension.h"
-#include "chrome/common/extensions/extension_constants.h"
 #include "chrome/test/base/testing_pref_service_syncable.h"
 #include "chrome/test/base/testing_profile.h"
-#include "components/user_prefs/pref_registry_syncable.h"
+#include "components/bookmarks/browser/bookmark_model.h"
+#include "components/bookmarks/test/bookmark_test_helpers.h"
+#include "components/pref_registry/pref_registry_syncable.h"
 #include "content/public/test/test_browser_thread_bundle.h"
 #include "content/public/test/test_utils.h"
-#include "extensions/common/manifest_constants.h"
-#include "extensions/common/permissions/permission_set.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 #if defined(OS_CHROMEOS)
-#include "chrome/browser/chromeos/login/user_manager.h"
+#include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h"
 #include "chrome/browser/chromeos/settings/cros_settings.h"
 #include "chrome/browser/chromeos/settings/device_settings_service.h"
 #endif
 
+#if defined(ENABLE_EXTENSIONS)
+#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/extensions/test_extension_system.h"
+#include "chrome/common/extensions/extension_constants.h"
+#include "extensions/browser/extension_prefs.h"
+#include "extensions/common/constants.h"
+#include "extensions/common/extension.h"
+#include "extensions/common/manifest_constants.h"
+#include "extensions/common/permissions/permission_set.h"
+#endif
+
 namespace {
 
 template<typename T>
@@ -71,20 +76,17 @@ class TestingPrefStoreWithCustomReadError : public TestingPrefStore {
     // By default the profile is "new" (NO_FILE means that the profile
     // wasn't found on disk, so it was created).
   }
-  virtual PrefReadError GetReadError() const OVERRIDE {
-    return read_error_;
-  }
-  virtual bool IsInitializationComplete() const OVERRIDE {
-    return true;
-  }
+  PrefReadError GetReadError() const override { return read_error_; }
+  bool IsInitializationComplete() const override { return true; }
   void set_read_error(PrefReadError read_error) {
     read_error_ = read_error;
   }
  private:
-  virtual ~TestingPrefStoreWithCustomReadError() {}
+  ~TestingPrefStoreWithCustomReadError() override {}
   PrefReadError read_error_;
 };
 
+#if defined(ENABLE_EXTENSIONS)
 #if defined(OS_WIN)
 const base::FilePath::CharType kExtensionFilePath[] =
     FILE_PATH_LITERAL("c:\\foo");
@@ -96,7 +98,7 @@ const base::FilePath::CharType kExtensionFilePath[] =
 static scoped_refptr<extensions::Extension> CreateExtension(
     const std::string& name,
     const std::string& id) {
-  DictionaryValue manifest;
+  base::DictionaryValue manifest;
   manifest.SetString(extensions::manifest_keys::kVersion, "1.0.0.0");
   manifest.SetString(extensions::manifest_keys::kName, name);
   std::string error;
@@ -110,6 +112,7 @@ static scoped_refptr<extensions::Extension> CreateExtension(
         &error);
   return extension;
 }
+#endif
 
 }  // namespace
 
@@ -120,7 +123,7 @@ class ProfileSigninConfirmationHelperTest : public testing::Test {
         model_(NULL) {
   }
 
-  virtual void SetUp() OVERRIDE {
+  void SetUp() override {
     // Create the profile.
     TestingProfile::Builder builder;
     user_prefs_ = new TestingPrefStoreWithCustomReadError;
@@ -137,8 +140,9 @@ class ProfileSigninConfirmationHelperTest : public testing::Test {
     // Initialize the services we check.
     profile_->CreateBookmarkModel(true);
     model_ = BookmarkModelFactory::GetForProfile(profile_.get());
-    test::WaitForBookmarkModelToLoad(model_);
+    bookmarks::test::WaitForBookmarkModelToLoad(model_);
     ASSERT_TRUE(profile_->CreateHistoryService(true, false));
+#if defined(ENABLE_EXTENSIONS)
     extensions::TestExtensionSystem* system =
         static_cast<extensions::TestExtensionSystem*>(
             extensions::ExtensionSystem::Get(profile_.get()));
@@ -146,9 +150,10 @@ class ProfileSigninConfirmationHelperTest : public testing::Test {
     system->CreateExtensionService(&command_line,
                                    base::FilePath(kExtensionFilePath),
                                    false);
+#endif
   }
 
-  virtual void TearDown() OVERRIDE {
+  void TearDown() override {
     // TestExtensionSystem uses DeleteSoon, so we need to delete the profile
     // and then run the message queue to clean up.
     profile_.reset();
@@ -168,7 +173,8 @@ class ProfileSigninConfirmationHelperTest : public testing::Test {
 #endif
 };
 
-TEST_F(ProfileSigninConfirmationHelperTest, DoNotPromptForNewProfile) {
+// http://crbug.com/393149
+TEST_F(ProfileSigninConfirmationHelperTest, DISABLED_DoNotPromptForNewProfile) {
   // Profile is new and there's no profile data.
   EXPECT_FALSE(
       GetCallbackResult(
@@ -181,7 +187,8 @@ TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Bookmarks) {
   ASSERT_TRUE(model_);
 
   // Profile is new but has bookmarks.
-  model_->AddURL(model_->bookmark_bar_node(), 0, string16(ASCIIToUTF16("foo")),
+  model_->AddURL(model_->bookmark_bar_node(), 0,
+                 base::string16(base::ASCIIToUTF16("foo")),
                  GURL("http://foo.com"));
   EXPECT_TRUE(
       GetCallbackResult(
@@ -190,6 +197,7 @@ TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Bookmarks) {
               profile_.get())));
 }
 
+#if defined(ENABLE_EXTENSIONS)
 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Extensions) {
   ExtensionService* extensions =
       extensions::ExtensionSystem::Get(profile_.get())->extension_service();
@@ -199,8 +207,8 @@ TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Extensions) {
 
   // (The web store doesn't count.)
   scoped_refptr<extensions::Extension> webstore =
-      CreateExtension("web store", extension_misc::kWebStoreAppId);
-  extensions->extension_prefs()->AddGrantedPermissions(
+      CreateExtension("web store", extensions::kWebStoreAppId);
+  extensions::ExtensionPrefs::Get(profile_.get())->AddGrantedPermissions(
       webstore->id(), make_scoped_refptr(new extensions::PermissionSet).get());
   extensions->AddExtension(webstore.get());
   EXPECT_FALSE(GetCallbackResult(
@@ -208,14 +216,17 @@ TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Extensions) {
 
   scoped_refptr<extensions::Extension> extension =
       CreateExtension("foo", std::string());
-  extensions->extension_prefs()->AddGrantedPermissions(
+  extensions::ExtensionPrefs::Get(profile_.get())->AddGrantedPermissions(
       extension->id(), make_scoped_refptr(new extensions::PermissionSet).get());
   extensions->AddExtension(extension.get());
   EXPECT_TRUE(GetCallbackResult(
       base::Bind(&ui::CheckShouldPromptForNewProfile, profile_.get())));
 }
+#endif
 
-TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_History) {
+// http://crbug.com/393149
+TEST_F(ProfileSigninConfirmationHelperTest,
+       DISABLED_PromptForNewProfile_History) {
   HistoryService* history = HistoryServiceFactory::GetForProfile(
       profile_.get(),
       Profile::EXPLICIT_ACCESS);
@@ -228,7 +239,7 @@ TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_History) {
     base::snprintf(buf, arraysize(buf), "http://foo.com/%d", i);
     history->AddPage(
         GURL(std::string(buf)), base::Time::Now(), NULL, 1,
-        GURL(), history::RedirectList(), content::PAGE_TRANSITION_LINK,
+        GURL(), history::RedirectList(), ui::PAGE_TRANSITION_LINK,
         history::SOURCE_BROWSED, false);
   }
   EXPECT_TRUE(
@@ -238,7 +249,9 @@ TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_History) {
               profile_.get())));
 }
 
-TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_TypedURLs) {
+// http://crbug.com/393149
+TEST_F(ProfileSigninConfirmationHelperTest,
+       DISABLED_PromptForNewProfile_TypedURLs) {
   HistoryService* history = HistoryServiceFactory::GetForProfile(
       profile_.get(),
       Profile::EXPLICIT_ACCESS);
@@ -247,7 +260,7 @@ TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_TypedURLs) {
   // Profile is new but has a typed URL.
   history->AddPage(
       GURL("http://example.com"), base::Time::Now(), NULL, 1,
-      GURL(), history::RedirectList(), content::PAGE_TRANSITION_TYPED,
+      GURL(), history::RedirectList(), ui::PAGE_TRANSITION_TYPED,
       history::SOURCE_BROWSED, false);
   EXPECT_TRUE(
       GetCallbackResult(