| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/strings/string_number_conversions.h" | 6 #include "base/strings/string_number_conversions.h" |
| 7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/extensions/dev_mode_bubble_controller.h" | 10 #include "chrome/browser/extensions/dev_mode_bubble_controller.h" |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 // specifying which extension is controlling the proxy, but unfortunately | 367 // specifying which extension is controlling the proxy, but unfortunately |
| 368 // that Map is not updated automatically for unit tests, so we simulate the | 368 // that Map is not updated automatically for unit tests, so we simulate the |
| 369 // update here to avoid test failures. | 369 // update here to avoid test failures. |
| 370 ExtensionPrefValueMap* extension_prefs_value_map = | 370 ExtensionPrefValueMap* extension_prefs_value_map = |
| 371 ExtensionPrefValueMapFactory::GetForBrowserContext(profile()); | 371 ExtensionPrefValueMapFactory::GetForBrowserContext(profile()); |
| 372 extension_prefs_value_map->RegisterExtension( | 372 extension_prefs_value_map->RegisterExtension( |
| 373 id, | 373 id, |
| 374 base::Time::Now(), | 374 base::Time::Now(), |
| 375 true, // is_enabled. | 375 true, // is_enabled. |
| 376 false); // is_incognito_enabled. | 376 false); // is_incognito_enabled. |
| 377 extension_prefs_value_map->SetExtensionPref( | 377 extension_prefs_value_map->SetExtensionPref(id, |
| 378 id, | 378 prefs::kProxy, |
| 379 prefs::kProxy, | 379 kExtensionPrefsScopeRegular, |
| 380 kExtensionPrefsScopeRegular, | 380 new base::StringValue(id)); |
| 381 base::Value::CreateStringValue(id)); | |
| 382 | 381 |
| 383 if (ExtensionRegistry::Get(profile())->enabled_extensions().GetByID(id)) | 382 if (ExtensionRegistry::Get(profile())->enabled_extensions().GetByID(id)) |
| 384 return testing::AssertionSuccess(); | 383 return testing::AssertionSuccess(); |
| 385 return testing::AssertionFailure() << "Could not install extension: " << id; | 384 return testing::AssertionFailure() << "Could not install extension: " << id; |
| 386 } | 385 } |
| 387 | 386 |
| 388 void Init() { | 387 void Init() { |
| 389 // The two lines of magical incantation required to get the extension | 388 // The two lines of magical incantation required to get the extension |
| 390 // service to work inside a unit test and access the extension prefs. | 389 // service to work inside a unit test and access the extension prefs. |
| 391 thread_bundle_.reset(new content::TestBrowserThreadBundle); | 390 thread_bundle_.reset(new content::TestBrowserThreadBundle); |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 // Clean up after ourselves. | 946 // Clean up after ourselves. |
| 948 service_->UninstallExtension( | 947 service_->UninstallExtension( |
| 949 kId1, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); | 948 kId1, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); |
| 950 service_->UninstallExtension( | 949 service_->UninstallExtension( |
| 951 kId2, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); | 950 kId2, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); |
| 952 service_->UninstallExtension( | 951 service_->UninstallExtension( |
| 953 kId3, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); | 952 kId3, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); |
| 954 } | 953 } |
| 955 | 954 |
| 956 } // namespace extensions | 955 } // namespace extensions |
| OLD | NEW |