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

Side by Side Diff: components/autofill/browser/personal_data_manager_unittest.cc

Issue 12847010: Fix leaks introduced by WDS change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comment Created 7 years, 9 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/signin/token_service_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/guid.h" 8 #include "base/guid.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/synchronization/waitable_event.h"
11 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/password_manager/encryptor.h" 13 #include "chrome/browser/password_manager/encryptor.h"
13 #include "chrome/browser/webdata/web_data_service.h" 14 #include "chrome/browser/webdata/web_data_service.h"
14 #include "chrome/test/base/testing_browser_process.h" 15 #include "chrome/test/base/testing_browser_process.h"
15 #include "chrome/test/base/testing_profile.h" 16 #include "chrome/test/base/testing_profile.h"
16 #include "components/autofill/browser/autofill_common_test.h" 17 #include "components/autofill/browser/autofill_common_test.h"
17 #include "components/autofill/browser/autofill_metrics.h" 18 #include "components/autofill/browser/autofill_metrics.h"
18 #include "components/autofill/browser/autofill_profile.h" 19 #include "components/autofill/browser/autofill_profile.h"
19 #include "components/autofill/browser/form_structure.h" 20 #include "components/autofill/browser/form_structure.h"
20 #include "components/autofill/browser/personal_data_manager.h" 21 #include "components/autofill/browser/personal_data_manager.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 73
73 autofill_test::DisableSystemServices(profile_.get()); 74 autofill_test::DisableSystemServices(profile_.get());
74 ResetPersonalDataManager(); 75 ResetPersonalDataManager();
75 } 76 }
76 77
77 virtual void TearDown() { 78 virtual void TearDown() {
78 // Destruction order is imposed explicitly here. 79 // Destruction order is imposed explicitly here.
79 personal_data_.reset(NULL); 80 personal_data_.reset(NULL);
80 profile_.reset(NULL); 81 profile_.reset(NULL);
81 82
82 db_thread_.Stop(); 83 // Schedule another task on the DB thread to notify us that it's safe to
84 // stop the thread.
85 base::WaitableEvent done(false, false);
86 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
87 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done)));
88 done.Wait();
83 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); 89 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure());
84 MessageLoop::current()->Run(); 90 MessageLoop::current()->Run();
91 db_thread_.Stop();
85 } 92 }
86 93
87 void ResetPersonalDataManager() { 94 void ResetPersonalDataManager() {
88 personal_data_.reset(new PersonalDataManager); 95 personal_data_.reset(new PersonalDataManager);
89 personal_data_->Init(profile_.get()); 96 personal_data_->Init(profile_.get());
90 personal_data_->AddObserver(&personal_data_observer_); 97 personal_data_->AddObserver(&personal_data_observer_);
91 98
92 // Verify that the web database has been updated and the notification sent. 99 // Verify that the web database has been updated and the notification sent.
93 EXPECT_CALL(personal_data_observer_, 100 EXPECT_CALL(personal_data_observer_,
94 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); 101 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop());
(...skipping 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1964 1971
1965 // Modify expected to include multi-valued fields. 1972 // Modify expected to include multi-valued fields.
1966 std::vector<string16> values; 1973 std::vector<string16> values;
1967 expected.GetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, &values); 1974 expected.GetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, &values);
1968 values.push_back(ASCIIToUTF16("(214) 555-1234")); 1975 values.push_back(ASCIIToUTF16("(214) 555-1234"));
1969 expected.SetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, values); 1976 expected.SetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, values);
1970 1977
1971 ASSERT_EQ(1U, results2.size()); 1978 ASSERT_EQ(1U, results2.size());
1972 EXPECT_EQ(0, expected.Compare(*results2[0])); 1979 EXPECT_EQ(0, expected.Compare(*results2[0]));
1973 } 1980 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/token_service_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698