diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-26 03:52:50 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-26 03:52:50 +0000 |
commit | d9cb5f982bd30a487c27baa350ed6d40ed7e7db6 (patch) | |
tree | 6461ed9b5b6d425be022823ed93e584ccf263eba /chromeos | |
parent | f26b40e5ce6ebd45c637f12d72d74d99aca185c9 (diff) | |
download | chromium_src-d9cb5f982bd30a487c27baa350ed6d40ed7e7db6.zip chromium_src-d9cb5f982bd30a487c27baa350ed6d40ed7e7db6.tar.gz chromium_src-d9cb5f982bd30a487c27baa350ed6d40ed7e7db6.tar.bz2 |
Revert 144101 - Change InputMethodIBus unittests to IBusClient free one.
Before removing the IBusClient, remove IBusClient dependency from InputMethodIBusUnittests.
BUG=126947
TEST=ran ui_unittests
Review URL: https://chromiumcodereview.appspot.com/10668012
TBR=nona@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10663031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144103 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
-rw-r--r-- | chromeos/dbus/ibus/ibus_input_context_client.cc | 4 | ||||
-rw-r--r-- | chromeos/dbus/ibus/ibus_input_context_client.h | 6 | ||||
-rw-r--r-- | chromeos/dbus/ibus/ibus_input_context_client_unittest.cc | 4 | ||||
-rw-r--r-- | chromeos/dbus/ibus/mock_ibus_client.cc | 7 | ||||
-rw-r--r-- | chromeos/dbus/ibus/mock_ibus_client.h | 24 | ||||
-rw-r--r-- | chromeos/dbus/ibus/mock_ibus_input_context_client.cc | 27 | ||||
-rw-r--r-- | chromeos/dbus/ibus/mock_ibus_input_context_client.h | 48 | ||||
-rw-r--r-- | chromeos/dbus/mock_dbus_thread_manager_without_gmock.cc | 7 | ||||
-rw-r--r-- | chromeos/dbus/mock_dbus_thread_manager_without_gmock.h | 6 |
9 files changed, 13 insertions, 120 deletions
diff --git a/chromeos/dbus/ibus/ibus_input_context_client.cc b/chromeos/dbus/ibus/ibus_input_context_client.cc index 8083f8c..10e7d6f 100644 --- a/chromeos/dbus/ibus/ibus_input_context_client.cc +++ b/chromeos/dbus/ibus/ibus_input_context_client.cc @@ -67,7 +67,7 @@ class IBusInputContextClientImpl : public IBusInputContextClient { } // IBusInputContextClient override. - virtual bool IsObjectProxyReady() const OVERRIDE { + virtual bool IsConnected() const OVERRIDE { return proxy_ != NULL; } @@ -374,7 +374,7 @@ class IBusInputContextClientStubImpl : public IBusInputContextClient { // IBusInputContextClient override. virtual void ResetObjectProxy() OVERRIDE {} // IBusInputContextClient override. - virtual bool IsObjectProxyReady() const OVERRIDE { + virtual bool IsConnected() const OVERRIDE { return true; } // IBusInputContextClient overrides. diff --git a/chromeos/dbus/ibus/ibus_input_context_client.h b/chromeos/dbus/ibus/ibus_input_context_client.h index 7edc577..3b543f2 100644 --- a/chromeos/dbus/ibus/ibus_input_context_client.h +++ b/chromeos/dbus/ibus/ibus_input_context_client.h @@ -52,9 +52,9 @@ class CHROMEOS_EXPORT IBusInputContextClient { // Initialize function again. virtual void ResetObjectProxy() = 0; - // Returns true if the object proxy is ready to communicate with ibus-daemon, - // otherwise return false. - virtual bool IsObjectProxyReady() const = 0; + // Returns true if connected to target input context path, otherwise return + // false. + virtual bool IsConnected() const = 0; // Signal handler accessors. Setting function can be called multiple times. If // you call setting function multiple times, previous callback will be diff --git a/chromeos/dbus/ibus/ibus_input_context_client_unittest.cc b/chromeos/dbus/ibus/ibus_input_context_client_unittest.cc index d01b3a5..c4429b1 100644 --- a/chromeos/dbus/ibus/ibus_input_context_client_unittest.cc +++ b/chromeos/dbus/ibus/ibus_input_context_client_unittest.cc @@ -147,9 +147,9 @@ class IBusInputContextClientTest : public testing::Test { } virtual void TearDown() OVERRIDE { - EXPECT_TRUE(client_->IsObjectProxyReady()); + EXPECT_TRUE(client_->IsConnected()); client_->ResetObjectProxy(); - EXPECT_FALSE(client_->IsObjectProxyReady()); + EXPECT_FALSE(client_->IsConnected()); } // Handles FocusIn method call. diff --git a/chromeos/dbus/ibus/mock_ibus_client.cc b/chromeos/dbus/ibus/mock_ibus_client.cc index d185f5f..bf97086 100644 --- a/chromeos/dbus/ibus/mock_ibus_client.cc +++ b/chromeos/dbus/ibus/mock_ibus_client.cc @@ -6,9 +6,7 @@ namespace chromeos { -MockIBusClient::MockIBusClient() - : create_input_context_call_count_(0) { -} +MockIBusClient::MockIBusClient() {} MockIBusClient::~MockIBusClient() {} @@ -16,9 +14,6 @@ void MockIBusClient::CreateInputContext( const std::string& client_name, const CreateInputContextCallback& callback, const ErrorCallback& error_callback) { - create_input_context_call_count_ ++; - if (!create_input_context_handler_.is_null()) - create_input_context_handler_.Run(client_name, callback, error_callback); } } // namespace chromeos diff --git a/chromeos/dbus/ibus/mock_ibus_client.h b/chromeos/dbus/ibus/mock_ibus_client.h index b14c7c4..756fe22a 100644 --- a/chromeos/dbus/ibus/mock_ibus_client.h +++ b/chromeos/dbus/ibus/mock_ibus_client.h @@ -7,7 +7,6 @@ #pragma once #include <string> -#include "base/callback.h" #include "chromeos/dbus/ibus/ibus_client.h" namespace chromeos { @@ -17,32 +16,9 @@ class MockIBusClient : public IBusClient { MockIBusClient(); virtual ~MockIBusClient(); - typedef base::Callback<void(const std::string& client_name, - const CreateInputContextCallback& callback, - const ErrorCallback& error_callback)> - CreateInputContextHandler; - virtual void CreateInputContext(const std::string& client_name, const CreateInputContextCallback& callback, const ErrorCallback& error_callback) OVERRIDE; - - // Function handler for CreateInputContext. The CreateInputContext function - // invokes |create_input_context_handler_| unless it's not null. - void set_create_input_context_handler( - const CreateInputContextHandler& handler) { - create_input_context_handler_ = handler; - } - - // Represents call count of CreateInputContext. - int create_input_context_call_count() const { - return create_input_context_call_count_; - } - - private: - CreateInputContextHandler create_input_context_handler_; - int create_input_context_call_count_; - - DISALLOW_COPY_AND_ASSIGN(MockIBusClient); }; } // namespace chromeos diff --git a/chromeos/dbus/ibus/mock_ibus_input_context_client.cc b/chromeos/dbus/ibus/mock_ibus_input_context_client.cc index edfa702..53b9ea4 100644 --- a/chromeos/dbus/ibus/mock_ibus_input_context_client.cc +++ b/chromeos/dbus/ibus/mock_ibus_input_context_client.cc @@ -6,36 +6,19 @@ namespace chromeos { -MockIBusInputContextClient::MockIBusInputContextClient() - : initialize_call_count_(0), - is_initialized_(false), - reset_object_proxy_call_caount_(0), - set_capabilities_call_count_(0), - focus_in_call_count_(0), - focus_out_call_count_(0), - reset_call_count_(0), - set_cursor_location_call_count_(0), - process_key_event_call_count_(0) { -} +MockIBusInputContextClient::MockIBusInputContextClient() {} MockIBusInputContextClient::~MockIBusInputContextClient() {} void MockIBusInputContextClient::Initialize( dbus::Bus* bus, const dbus::ObjectPath& object_path) { - initialize_call_count_++; - is_initialized_ = true; } void MockIBusInputContextClient::ResetObjectProxy() { - reset_object_proxy_call_caount_++; - is_initialized_ = false; } -bool MockIBusInputContextClient::IsObjectProxyReady() const { - if (is_initialized_) +bool MockIBusInputContextClient::IsConnected() const { return true; - else - return false; } void MockIBusInputContextClient::SetCommitTextHandler( @@ -74,24 +57,19 @@ void MockIBusInputContextClient::UnsetHidePreeditTextHandler() { } void MockIBusInputContextClient::SetCapabilities(uint32 capabilities) { - set_capabilities_call_count_++; } void MockIBusInputContextClient::FocusIn() { - focus_in_call_count_++; } void MockIBusInputContextClient::FocusOut() { - focus_out_call_count_++; } void MockIBusInputContextClient::Reset() { - reset_call_count_++; } void MockIBusInputContextClient::SetCursorLocation( int32 x, int32 y, int32 w, int32 h) { - set_cursor_location_call_count_++; } void MockIBusInputContextClient::ProcessKeyEvent( @@ -99,7 +77,6 @@ void MockIBusInputContextClient::ProcessKeyEvent( uint32 keycode, uint32 state, const ProcessKeyEventCallback& callback) { - process_key_event_call_count_++; } } // namespace chromeos diff --git a/chromeos/dbus/ibus/mock_ibus_input_context_client.h b/chromeos/dbus/ibus/mock_ibus_input_context_client.h index 38944f1..1e2a58c 100644 --- a/chromeos/dbus/ibus/mock_ibus_input_context_client.h +++ b/chromeos/dbus/ibus/mock_ibus_input_context_client.h @@ -5,7 +5,6 @@ #ifndef CHROMEOS_DBUS_IBUS_MOCK_IBUS_INPUT_CONTEXT_CLIENT_H_ #define CHROMEOS_DBUS_IBUS_MOCK_IBUS_INPUT_CONTEXT_CLIENT_H_ -#include "base/basictypes.h" #include "chromeos/dbus/ibus/ibus_input_context_client.h" namespace chromeos { @@ -17,7 +16,7 @@ class MockIBusInputContextClient : public IBusInputContextClient { virtual void Initialize(dbus::Bus* bus, const dbus::ObjectPath& object_path) OVERRIDE; virtual void ResetObjectProxy() OVERRIDE; - virtual bool IsObjectProxyReady() const OVERRIDE; + virtual bool IsConnected() const OVERRIDE; virtual void SetCommitTextHandler( const CommitTextHandler& commit_text_handler) OVERRIDE; virtual void SetForwardKeyEventHandler( @@ -40,51 +39,6 @@ class MockIBusInputContextClient : public IBusInputContextClient { virtual void SetCursorLocation(int32 x, int32 y, int32 w, int32 h) OVERRIDE; virtual void ProcessKeyEvent(uint32 keyval, uint32 keycode, uint32 state, const ProcessKeyEventCallback& callback) OVERRIDE; - - // Call count of Initialize(). - int initialize_call_count() const { return initialize_call_count_; } - - // Call count of ResetObjectProxy(). - int reset_object_proxy_call_caount() const { - return reset_object_proxy_call_caount_; - } - - // Call count of SetCapabilities(). - int set_capabilities_call_count() const { - return set_capabilities_call_count_; - } - - // Call count of FocusIn(). - int focus_in_call_count() const { return focus_in_call_count_; } - - // Call count of FocusOut(). - int focus_out_call_count() const { return focus_out_call_count_; } - - // Call count of Reset(). - int reset_call_count() const { return reset_call_count_; } - - // Call count of SetCursorLocation(). - int set_cursor_location_call_count() const { - return set_cursor_location_call_count_; - } - - // Call count of ProcessKeyEvent(). - int process_key_event_call_count() const { - return process_key_event_call_count_; - } - - private: - int initialize_call_count_; - bool is_initialized_; - int reset_object_proxy_call_caount_; - int set_capabilities_call_count_; - int focus_in_call_count_; - int focus_out_call_count_; - int reset_call_count_; - int set_cursor_location_call_count_; - int process_key_event_call_count_; - - DISALLOW_COPY_AND_ASSIGN(MockIBusInputContextClient); }; } // namespace chromeos diff --git a/chromeos/dbus/mock_dbus_thread_manager_without_gmock.cc b/chromeos/dbus/mock_dbus_thread_manager_without_gmock.cc index ab6dad2..4d5c327 100644 --- a/chromeos/dbus/mock_dbus_thread_manager_without_gmock.cc +++ b/chromeos/dbus/mock_dbus_thread_manager_without_gmock.cc @@ -11,16 +11,13 @@ namespace chromeos { MockDBusThreadManagerWithoutGMock::MockDBusThreadManagerWithoutGMock() : mock_ibus_client_(new MockIBusClient), - mock_ibus_input_context_client_(new MockIBusInputContextClient), - ibus_bus_(NULL) { + mock_ibus_input_context_client_(new MockIBusInputContextClient) { } MockDBusThreadManagerWithoutGMock::~MockDBusThreadManagerWithoutGMock() {} void MockDBusThreadManagerWithoutGMock::InitIBusBus( const std::string& ibus_address) { - // Non-null bus address is used to ensure the connection to ibus-daemon. - ibus_bus_ = reinterpret_cast<dbus::Bus*>(0xdeadbeef); } dbus::Bus* MockDBusThreadManagerWithoutGMock::GetSystemBus() { @@ -28,7 +25,7 @@ dbus::Bus* MockDBusThreadManagerWithoutGMock::GetSystemBus() { } dbus::Bus* MockDBusThreadManagerWithoutGMock::GetIBusBus() { - return ibus_bus_; + return NULL; } BluetoothAdapterClient* diff --git a/chromeos/dbus/mock_dbus_thread_manager_without_gmock.h b/chromeos/dbus/mock_dbus_thread_manager_without_gmock.h index 36e6893..9bde865 100644 --- a/chromeos/dbus/mock_dbus_thread_manager_without_gmock.h +++ b/chromeos/dbus/mock_dbus_thread_manager_without_gmock.h @@ -64,20 +64,14 @@ class MockDBusThreadManagerWithoutGMock : public DBusThreadManager { MockIBusClient* mock_ibus_client() { return mock_ibus_client_.get(); } - MockIBusInputContextClient* mock_ibus_input_context_client() { return mock_ibus_input_context_client_.get(); } - void set_ibus_bus(dbus::Bus* ibus_bus) { - ibus_bus_ = ibus_bus; - } - private: scoped_ptr<MockIBusClient> mock_ibus_client_; scoped_ptr<MockIBusInputContextClient> mock_ibus_input_context_client_; - dbus::Bus* ibus_bus_; DISALLOW_COPY_AND_ASSIGN(MockDBusThreadManagerWithoutGMock); }; |