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

Side by Side Diff: chrome/browser/signin/token_service_unittest.cc

Issue 15734014: Split token-related methods from WebDataService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix DEPs again Created 7 years, 6 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
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"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
14 #include "chrome/browser/signin/token_service_factory.h" 14 #include "chrome/browser/signin/token_service_factory.h"
15 #include "chrome/browser/webdata/web_data_service.h" 15 #include "chrome/browser/webdata/token_web_data.h"
16 #include "chrome/common/chrome_notification_types.h" 16 #include "chrome/common/chrome_notification_types.h"
17 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
18 #include "components/webdata/encryptor/encryptor.h" 18 #include "components/webdata/encryptor/encryptor.h"
19 #include "google_apis/gaia/gaia_constants.h" 19 #include "google_apis/gaia/gaia_constants.h"
20 #include "google_apis/gaia/mock_url_fetcher_factory.h" 20 #include "google_apis/gaia/mock_url_fetcher_factory.h"
21 #include "net/url_request/test_url_fetcher_factory.h" 21 #include "net/url_request/test_url_fetcher_factory.h"
22 22
23 using content::BrowserThread; 23 using content::BrowserThread;
24 24
25 TokenAvailableTracker::TokenAvailableTracker() {} 25 TokenAvailableTracker::TokenAvailableTracker() {}
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); 100 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure());
101 MessageLoop::current()->Run(); 101 MessageLoop::current()->Run();
102 db_thread_.Stop(); 102 db_thread_.Stop();
103 } 103 }
104 104
105 void TokenServiceTestHarness::WaitForDBLoadCompletion() { 105 void TokenServiceTestHarness::WaitForDBLoadCompletion() {
106 // Force the loading of the WebDataService. 106 // Force the loading of the WebDataService.
107 WebDataService::FromBrowserContext(profile_.get()); 107 TokenWebData::FromBrowserContext(profile_.get());
108 108
109 // 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
110 // 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
111 // operations should be complete. 111 // operations should be complete.
112 base::WaitableEvent done(false, false); 112 base::WaitableEvent done(false, false);
113 BrowserThread::PostTask( 113 BrowserThread::PostTask(
114 BrowserThread::DB, 114 BrowserThread::DB,
115 FROM_HERE, 115 FROM_HERE,
116 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); 116 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done)));
117 done.Wait(); 117 done.Wait();
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 418
419 *CommandLine::ForCurrentProcess() = original_cl; 419 *CommandLine::ForCurrentProcess() = original_cl;
420 } 420 }
421 }; 421 };
422 422
423 TEST_F(TokenServiceCommandLineTest, TestValueOverride) { 423 TEST_F(TokenServiceCommandLineTest, TestValueOverride) {
424 EXPECT_TRUE(service_->HasTokenForService("my_service")); 424 EXPECT_TRUE(service_->HasTokenForService("my_service"));
425 EXPECT_EQ("my_value", service_->GetTokenForService("my_service")); 425 EXPECT_EQ("my_value", service_->GetTokenForService("my_service"));
426 } 426 }
427 #endif // ifndef NDEBUG 427 #endif // ifndef NDEBUG
OLDNEW
« no previous file with comments | « chrome/browser/signin/token_service_unittest.h ('k') | chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698