| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/sync/test/integration/themes_helper.h" | 5 #include "chrome/browser/sync/test/integration/themes_helper.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
| 12 #include "chrome/browser/sync/test/integration/status_change_checker.h" | 12 #include "chrome/browser/sync/test/integration/status_change_checker.h" |
| 13 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" | 13 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" |
| 14 #include "chrome/browser/sync/test/integration/sync_extension_helper.h" | 14 #include "chrome/browser/sync/test/integration/sync_extension_helper.h" |
| 15 #include "chrome/browser/themes/theme_service.h" | 15 #include "chrome/browser/themes/theme_service.h" |
| 16 #include "chrome/browser/themes/theme_service_factory.h" | 16 #include "chrome/browser/themes/theme_service_factory.h" |
| 17 #include "components/crx_file/id_util.h" |
| 17 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
| 18 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
| 19 #include "content/public/browser/notification_source.h" | 20 #include "content/public/browser/notification_source.h" |
| 20 #include "extensions/common/extension.h" | |
| 21 #include "extensions/common/id_util.h" | |
| 22 #include "extensions/common/manifest.h" | 21 #include "extensions/common/manifest.h" |
| 23 | 22 |
| 24 using sync_datatype_helper::test; | 23 using sync_datatype_helper::test; |
| 25 | 24 |
| 26 namespace { | 25 namespace { |
| 27 | 26 |
| 28 // Make a name to pass to an extension helper. | 27 // Make a name to pass to an extension helper. |
| 29 std::string MakeName(int index) { | 28 std::string MakeName(int index) { |
| 30 return "faketheme" + base::IntToString(index); | 29 return "faketheme" + base::IntToString(index); |
| 31 } | 30 } |
| 32 | 31 |
| 33 ThemeService* GetThemeService(Profile* profile) { | 32 ThemeService* GetThemeService(Profile* profile) { |
| 34 return ThemeServiceFactory::GetForProfile(profile); | 33 return ThemeServiceFactory::GetForProfile(profile); |
| 35 } | 34 } |
| 36 | 35 |
| 37 } // namespace | 36 } // namespace |
| 38 | 37 |
| 39 namespace themes_helper { | 38 namespace themes_helper { |
| 40 | 39 |
| 41 std::string GetCustomTheme(int index) { | 40 std::string GetCustomTheme(int index) { |
| 42 return extensions::id_util::GenerateId(MakeName(index)); | 41 return crx_file::id_util::GenerateId(MakeName(index)); |
| 43 } | 42 } |
| 44 | 43 |
| 45 std::string GetThemeID(Profile* profile) { | 44 std::string GetThemeID(Profile* profile) { |
| 46 return GetThemeService(profile)->GetThemeID(); | 45 return GetThemeService(profile)->GetThemeID(); |
| 47 } | 46 } |
| 48 | 47 |
| 49 bool UsingCustomTheme(Profile* profile) { | 48 bool UsingCustomTheme(Profile* profile) { |
| 50 return GetThemeID(profile) != ThemeService::kDefaultThemeID; | 49 return GetThemeID(profile) != ThemeService::kDefaultThemeID; |
| 51 } | 50 } |
| 52 | 51 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 bool AwaitUsingDefaultTheme(Profile* profile) { | 253 bool AwaitUsingDefaultTheme(Profile* profile) { |
| 255 ThemeConditionChecker checker( | 254 ThemeConditionChecker checker( |
| 256 profile, | 255 profile, |
| 257 std::string("Waiting until profile is using default theme"), | 256 std::string("Waiting until profile is using default theme"), |
| 258 base::Bind(&UsingDefaultThemeFunc)); | 257 base::Bind(&UsingDefaultThemeFunc)); |
| 259 checker.Wait(); | 258 checker.Wait(); |
| 260 return !checker.TimedOut(); | 259 return !checker.TimedOut(); |
| 261 } | 260 } |
| 262 | 261 |
| 263 } // namespace themes_helper | 262 } // namespace themes_helper |
| OLD | NEW |