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

Side by Side Diff: chrome/browser/signin/token_service_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 | « no previous file | components/autofill/browser/personal_data_manager_unittest.cc » ('j') | 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 // This file defines a unit test for the profile's token service. 5 // This file defines a unit test for the profile's token service.
6 6
7 #include "chrome/browser/signin/token_service_unittest.h" 7 #include "chrome/browser/signin/token_service_unittest.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // You have to destroy the profile before the db_thread_ stops. 90 // You have to destroy the profile before the db_thread_ stops.
91 if (profile_.get()) { 91 if (profile_.get()) {
92 profile_.reset(NULL); 92 profile_.reset(NULL);
93 } 93 }
94 // Schedule another task on the DB thread to notify us that it's safe to 94 // Schedule another task on the DB thread to notify us that it's safe to
95 // carry on with the test. 95 // carry on with the test.
96 base::WaitableEvent done(false, false); 96 base::WaitableEvent done(false, false);
97 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, 97 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
98 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); 98 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done)));
99 done.Wait(); 99 done.Wait();
100
101 db_thread_.Stop();
102 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); 100 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure());
103 MessageLoop::current()->Run(); 101 MessageLoop::current()->Run();
102 db_thread_.Stop();
104 } 103 }
105 104
106 void TokenServiceTestHarness::WaitForDBLoadCompletion() { 105 void TokenServiceTestHarness::WaitForDBLoadCompletion() {
107 // Force the loading of the WebDataService. 106 // Force the loading of the WebDataService.
108 WebDataService::FromBrowserContext(profile_.get()); 107 WebDataService::FromBrowserContext(profile_.get());
109 108
110 // The WebDB does all work on the DB thread. This will add an event 109 // The WebDB does all work on the DB thread. This will add an event
111 // to the end of the DB thread, so when we reach this task, all DB 110 // to the end of the DB thread, so when we reach this task, all DB
112 // operations should be complete. 111 // operations should be complete.
113 base::WaitableEvent done(false, false); 112 base::WaitableEvent done(false, false);
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 417
419 *CommandLine::ForCurrentProcess() = original_cl; 418 *CommandLine::ForCurrentProcess() = original_cl;
420 } 419 }
421 }; 420 };
422 421
423 TEST_F(TokenServiceCommandLineTest, TestValueOverride) { 422 TEST_F(TokenServiceCommandLineTest, TestValueOverride) {
424 EXPECT_TRUE(service_->HasTokenForService("my_service")); 423 EXPECT_TRUE(service_->HasTokenForService("my_service"));
425 EXPECT_EQ("my_value", service_->GetTokenForService("my_service")); 424 EXPECT_EQ("my_value", service_->GetTokenForService("my_service"));
426 } 425 }
427 #endif // ifndef NDEBUG 426 #endif // ifndef NDEBUG
OLDNEW
« no previous file with comments | « no previous file | components/autofill/browser/personal_data_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698