| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/sync/profile_sync_service.h" | 22 #include "chrome/browser/sync/profile_sync_service.h" |
| 23 #include "chrome/browser/sync/profile_sync_service_factory.h" | 23 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 24 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
| 25 #include "chrome/common/chrome_constants.h" | 25 #include "chrome/common/chrome_constants.h" |
| 26 #include "chrome/common/chrome_paths.h" | 26 #include "chrome/common/chrome_paths.h" |
| 27 #include "chrome/test/base/testing_profile.h" | 27 #include "chrome/test/base/testing_profile.h" |
| 28 #include "components/bookmarks/core/common/bookmark_constants.h" | 28 #include "components/bookmarks/core/common/bookmark_constants.h" |
| 29 #include "components/sync_driver/sync_prefs.h" | 29 #include "components/sync_driver/sync_prefs.h" |
| 30 #include "content/public/browser/browser_context.h" | 30 #include "content/public/browser/browser_context.h" |
| 31 | 31 |
| 32 #if defined(OS_CHROMEOS) |
| 33 #include "chromeos/chromeos_switches.h" |
| 34 #endif |
| 35 |
| 32 using extensions::PreferencesPrivateGetSyncCategoriesWithoutPassphraseFunction; | 36 using extensions::PreferencesPrivateGetSyncCategoriesWithoutPassphraseFunction; |
| 33 | 37 |
| 34 namespace { | 38 namespace { |
| 35 | 39 |
| 36 class FakeProfileSyncService : public ProfileSyncService { | 40 class FakeProfileSyncService : public ProfileSyncService { |
| 37 public: | 41 public: |
| 38 explicit FakeProfileSyncService(Profile* profile) | 42 explicit FakeProfileSyncService(Profile* profile) |
| 39 : ProfileSyncService( | 43 : ProfileSyncService( |
| 40 NULL, | 44 NULL, |
| 41 profile, | 45 profile, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 mutable bool initialized_state_violation_; | 104 mutable bool initialized_state_violation_; |
| 101 | 105 |
| 102 DISALLOW_COPY_AND_ASSIGN(FakeProfileSyncService); | 106 DISALLOW_COPY_AND_ASSIGN(FakeProfileSyncService); |
| 103 }; | 107 }; |
| 104 | 108 |
| 105 class PreferencesPrivateApiTest : public ExtensionApiTest { | 109 class PreferencesPrivateApiTest : public ExtensionApiTest { |
| 106 public: | 110 public: |
| 107 PreferencesPrivateApiTest() : browser_(NULL), service_(NULL) {} | 111 PreferencesPrivateApiTest() : browser_(NULL), service_(NULL) {} |
| 108 virtual ~PreferencesPrivateApiTest() {} | 112 virtual ~PreferencesPrivateApiTest() {} |
| 109 | 113 |
| 114 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 115 #if defined(OS_CHROMEOS) |
| 116 command_line->AppendSwitch( |
| 117 chromeos::switches::kIgnoreUserProfileMappingForTests); |
| 118 #endif |
| 119 } |
| 120 |
| 110 virtual void SetUpOnMainThread() OVERRIDE { | 121 virtual void SetUpOnMainThread() OVERRIDE { |
| 111 ExtensionApiTest::SetUpOnMainThread(); | 122 ExtensionApiTest::SetUpOnMainThread(); |
| 112 | 123 |
| 113 base::FilePath path; | 124 base::FilePath path; |
| 114 PathService::Get(chrome::DIR_USER_DATA, &path); | 125 PathService::Get(chrome::DIR_USER_DATA, &path); |
| 115 path = path.AppendASCII("test_profile"); | 126 path = path.AppendASCII("test_profile"); |
| 116 if (!base::PathExists(path)) | 127 if (!base::PathExists(path)) |
| 117 CHECK(base::CreateDirectory(path)); | 128 CHECK(base::CreateDirectory(path)); |
| 118 | 129 |
| 119 Profile* profile = | 130 Profile* profile = |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 191 |
| 181 // Verifies that we wait for the sync service to be ready before checking | 192 // Verifies that we wait for the sync service to be ready before checking |
| 182 // encryption status. | 193 // encryption status. |
| 183 IN_PROC_BROWSER_TEST_F(PreferencesPrivateApiTest, | 194 IN_PROC_BROWSER_TEST_F(PreferencesPrivateApiTest, |
| 184 GetSyncCategoriesWithoutPassphraseAsynchronous) { | 195 GetSyncCategoriesWithoutPassphraseAsynchronous) { |
| 185 service_->set_sync_initialized(false); | 196 service_->set_sync_initialized(false); |
| 186 TestGetSyncCategoriesWithoutPassphraseFunction(); | 197 TestGetSyncCategoriesWithoutPassphraseFunction(); |
| 187 } | 198 } |
| 188 | 199 |
| 189 } // namespace | 200 } // namespace |
| OLD | NEW |