Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(894)

Unified Diff: flimflam_proxy_unittest.cc

Issue 5860003: AU: fix double-free warning in flimflam proxy unittest (Closed) Base URL: http://git.chromium.org/git/update_engine.git@master
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: flimflam_proxy_unittest.cc
diff --git a/flimflam_proxy_unittest.cc b/flimflam_proxy_unittest.cc
index e1caa0170cb69473397a31c1cee26ae962fc3a34..5e18a320bba3dd20f14fa324a72e42d4b6de58f8 100644
--- a/flimflam_proxy_unittest.cc
+++ b/flimflam_proxy_unittest.cc
@@ -46,9 +46,9 @@ void FlimFlamProxyTest::TestWithServiceType(
ASSERT_NE(kMockSystemBus, reinterpret_cast<DBusGConnection*>(NULL));
const char* kServicePath = "/foo/service";
const char kGetPropertiesMethod[] = "GetProperties";
-
+
MockDbusGlib dbus_iface;
-
+
EXPECT_CALL(dbus_iface,
ProxyNewForNameOwner(kMockSystemBus,
StrEq(kFlimFlamDbusService),
@@ -63,22 +63,20 @@ void FlimFlamProxyTest::TestWithServiceType(
StrEq(kFlimFlamDbusServiceInterface),
_))
.WillOnce(Return(kMockFlimFlamServiceProxy));
-
+
EXPECT_CALL(dbus_iface, ProxyUnref(kMockFlimFlamManagerProxy));
EXPECT_CALL(dbus_iface, ProxyUnref(kMockFlimFlamServiceProxy));
EXPECT_CALL(dbus_iface, BusGet(DBUS_BUS_SYSTEM, _))
.Times(2)
.WillRepeatedly(Return(kMockSystemBus));
-
+
// Set up return value for first dbus call (to Manager object).
GHashTable* manager_hash_table = g_hash_table_new(g_str_hash, g_str_equal);
- ScopedRelease<GHashTable*, g_hash_table_unref> manager_hash_table_unref(
- manager_hash_table);
-
+
GArray* array = g_array_new(FALSE, FALSE, sizeof(const char*));
ASSERT_TRUE(array != NULL);
-
+
EXPECT_EQ(array, g_array_append_val(array, kServicePath));
GValue array_value = {0, {{0}}};
EXPECT_EQ(&array_value, g_value_init(&array_value, G_TYPE_ARRAY));
@@ -90,14 +88,12 @@ void FlimFlamProxyTest::TestWithServiceType(
// Set up return value for second dbus call (to Service object).
GHashTable* service_hash_table = g_hash_table_new(g_str_hash, g_str_equal);
- ScopedRelease<GHashTable*, g_hash_table_unref> service_hash_table_unref(
- service_hash_table);
-
+
GValue service_type_value = {0, {{0}}};
EXPECT_EQ(&service_type_value,
g_value_init(&service_type_value, G_TYPE_STRING));
g_value_set_static_string(&service_type_value, service_type);
-
+
g_hash_table_insert(service_hash_table,
const_cast<char*>("Type"),
&service_type_value);
@@ -125,7 +121,7 @@ void FlimFlamProxyTest::TestWithServiceType(
.WillOnce(DoAll(SetArgumentPointee<5>(service_hash_table), Return(TRUE)));
NetworkConnectionType type;
-
+
EXPECT_TRUE(FlimFlamProxy::GetConnectionType(&dbus_iface, &type));
EXPECT_EQ(expected_type, type);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698