| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // An implementation of BrowserProcess for unit tests that fails for most | 5 // An implementation of BrowserProcess for unit tests that fails for most |
| 6 // services. By preventing creation of services, we reduce dependencies and | 6 // services. By preventing creation of services, we reduce dependencies and |
| 7 // keep the profile clean. Clients of this class must handle the NULL return | 7 // keep the profile clean. Clients of this class must handle the NULL return |
| 8 // value, however. | 8 // value, however. |
| 9 | 9 |
| 10 #ifndef CHROME_TEST_TESTING_BROWSER_PROCESS_H__ | 10 #ifndef CHROME_TEST_TESTING_BROWSER_PROCESS_H__ |
| 11 #define CHROME_TEST_TESTING_BROWSER_PROCESS_H__ | 11 #define CHROME_TEST_TESTING_BROWSER_PROCESS_H__ |
| 12 | 12 |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 | 14 |
| 15 #include <string> | 15 #include <string> |
| 16 | 16 |
| 17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 18 #include "base/waitable_event.h" |
| 18 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/common/notification_service.h" | 20 #include "chrome/common/notification_service.h" |
| 20 #include "base/logging.h" | 21 #include "base/logging.h" |
| 21 | 22 |
| 22 class TestingBrowserProcess : public BrowserProcess { | 23 class TestingBrowserProcess : public BrowserProcess { |
| 23 public: | 24 public: |
| 24 TestingBrowserProcess() { | 25 TestingBrowserProcess() |
| 25 #if defined(OS_WIN) | 26 : shutdown_event_(new base::WaitableEvent(true, false)) { |
| 26 shutdown_event_ = ::CreateEvent(NULL, TRUE, FALSE, NULL); | |
| 27 #endif | |
| 28 } | 27 } |
| 28 |
| 29 virtual ~TestingBrowserProcess() { | 29 virtual ~TestingBrowserProcess() { |
| 30 } | 30 } |
| 31 | 31 |
| 32 virtual void EndSession() { | 32 virtual void EndSession() { |
| 33 } | 33 } |
| 34 | 34 |
| 35 virtual ResourceDispatcherHost* resource_dispatcher_host() { | 35 virtual ResourceDispatcherHost* resource_dispatcher_host() { |
| 36 return NULL; | 36 return NULL; |
| 37 } | 37 } |
| 38 | 38 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 virtual const std::wstring& GetApplicationLocale() { | 116 virtual const std::wstring& GetApplicationLocale() { |
| 117 static std::wstring* value = NULL; | 117 static std::wstring* value = NULL; |
| 118 if (!value) | 118 if (!value) |
| 119 value = new std::wstring(L"en"); | 119 value = new std::wstring(L"en"); |
| 120 return *value; | 120 return *value; |
| 121 } | 121 } |
| 122 | 122 |
| 123 virtual MemoryModel memory_model() { return HIGH_MEMORY_MODEL; } | 123 virtual MemoryModel memory_model() { return HIGH_MEMORY_MODEL; } |
| 124 | 124 |
| 125 #if defined(OS_WIN) | 125 virtual base::WaitableEvent* shutdown_event() { return shutdown_event_.get();
} |
| 126 virtual HANDLE shutdown_event() { return shutdown_event_; } | |
| 127 #endif | |
| 128 | 126 |
| 129 private: | 127 private: |
| 130 NotificationService notification_service_; | 128 NotificationService notification_service_; |
| 131 #if defined(OS_WIN) | 129 scoped_ptr<base::WaitableEvent> shutdown_event_; |
| 132 HANDLE shutdown_event_; | |
| 133 #endif | |
| 134 DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcess); | 130 DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcess); |
| 135 }; | 131 }; |
| 136 | 132 |
| 137 #endif // CHROME_TEST_TESTING_BROWSER_PROCESS_H__ | 133 #endif // CHROME_TEST_TESTING_BROWSER_PROCESS_H__ |
| 138 | 134 |
| OLD | NEW |