| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/extensions/extension_test_api.h" | 5 #include "chrome/browser/extensions/extension_test_api.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/singleton.h" | 9 #include "base/singleton.h" |
| 10 #include "chrome/browser/extensions/extensions_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| 11 #include "chrome/browser/extensions/extensions_quota_service.h" | 11 #include "chrome/browser/extensions/extensions_quota_service.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/common/notification_service.h" | 14 #include "chrome/common/notification_service.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 // If you see this error in your test, you need to set the config state | 18 // If you see this error in your test, you need to set the config state |
| 19 // to be returned by chrome.test.getConfig(). Do this by calling | 19 // to be returned by chrome.test.getConfig(). Do this by calling |
| 20 // ExtensionTestGetConfigFunction::set_test_config_state(Value* state) | 20 // ExtensionTestGetConfigFunction::set_test_config_state(Value* state) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 49 | 49 |
| 50 bool ExtensionTestLogFunction::RunImpl() { | 50 bool ExtensionTestLogFunction::RunImpl() { |
| 51 std::string message; | 51 std::string message; |
| 52 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &message)); | 52 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &message)); |
| 53 return true; | 53 return true; |
| 54 } | 54 } |
| 55 | 55 |
| 56 ExtensionTestQuotaResetFunction::~ExtensionTestQuotaResetFunction() {} | 56 ExtensionTestQuotaResetFunction::~ExtensionTestQuotaResetFunction() {} |
| 57 | 57 |
| 58 bool ExtensionTestQuotaResetFunction::RunImpl() { | 58 bool ExtensionTestQuotaResetFunction::RunImpl() { |
| 59 ExtensionsService* service = profile()->GetExtensionsService(); | 59 ExtensionService* service = profile()->GetExtensionService(); |
| 60 ExtensionsQuotaService* quota = service->quota_service(); | 60 ExtensionsQuotaService* quota = service->quota_service(); |
| 61 quota->Purge(); | 61 quota->Purge(); |
| 62 quota->violators_.clear(); | 62 quota->violators_.clear(); |
| 63 return true; | 63 return true; |
| 64 } | 64 } |
| 65 | 65 |
| 66 ExtensionTestCreateIncognitoTabFunction:: | 66 ExtensionTestCreateIncognitoTabFunction:: |
| 67 ~ExtensionTestCreateIncognitoTabFunction() {} | 67 ~ExtensionTestCreateIncognitoTabFunction() {} |
| 68 | 68 |
| 69 bool ExtensionTestCreateIncognitoTabFunction::RunImpl() { | 69 bool ExtensionTestCreateIncognitoTabFunction::RunImpl() { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 TestConfigState* test_config_state = TestConfigState::GetInstance(); | 113 TestConfigState* test_config_state = TestConfigState::GetInstance(); |
| 114 | 114 |
| 115 if (!test_config_state->config_state()) { | 115 if (!test_config_state->config_state()) { |
| 116 error_ = kNoTestConfigDataError; | 116 error_ = kNoTestConfigDataError; |
| 117 return false; | 117 return false; |
| 118 } | 118 } |
| 119 | 119 |
| 120 result_.reset(test_config_state->config_state()->DeepCopy()); | 120 result_.reset(test_config_state->config_state()->DeepCopy()); |
| 121 return true; | 121 return true; |
| 122 } | 122 } |
| OLD | NEW |