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

Side by Side Diff: chrome/browser/net/gaia/token_service_unittest.cc

Issue 8438034: Moving the SignalingTask class to base/test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Addressed comments Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/net/gaia/token_service_unittest.h" 7 #include "chrome/browser/net/gaia/token_service_unittest.h"
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
11 #include "base/test/signaling_task.h"
11 #include "chrome/browser/password_manager/encryptor.h" 12 #include "chrome/browser/password_manager/encryptor.h"
12 #include "chrome/common/chrome_notification_types.h" 13 #include "chrome/common/chrome_notification_types.h"
13 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/net/gaia/gaia_auth_fetcher_unittest.h" 15 #include "chrome/common/net/gaia/gaia_auth_fetcher_unittest.h"
15 #include "chrome/common/net/gaia/gaia_constants.h" 16 #include "chrome/common/net/gaia/gaia_constants.h"
16 #include "content/test/test_url_fetcher_factory.h" 17 #include "content/test/test_url_fetcher_factory.h"
17 18
18 TokenAvailableTracker::TokenAvailableTracker() {} 19 TokenAvailableTracker::TokenAvailableTracker() {}
19 20
20 TokenAvailableTracker::~TokenAvailableTracker() {} 21 TokenAvailableTracker::~TokenAvailableTracker() {}
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask); 88 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask);
88 MessageLoop::current()->Run(); 89 MessageLoop::current()->Run();
89 } 90 }
90 91
91 void TokenServiceTestHarness::WaitForDBLoadCompletion() { 92 void TokenServiceTestHarness::WaitForDBLoadCompletion() {
92 // The WebDB does all work on the DB thread. This will add an event 93 // The WebDB does all work on the DB thread. This will add an event
93 // to the end of the DB thread, so when we reach this task, all DB 94 // to the end of the DB thread, so when we reach this task, all DB
94 // operations should be complete. 95 // operations should be complete.
95 base::WaitableEvent done(false, false); 96 base::WaitableEvent done(false, false);
96 BrowserThread::PostTask( 97 BrowserThread::PostTask(
97 BrowserThread::DB, FROM_HERE, new SignalingTask(&done)); 98 BrowserThread::DB, FROM_HERE, new base::SignalingTask(&done));
98 done.Wait(); 99 done.Wait();
99 100
100 // Notifications should be returned from the DB thread onto the UI thread. 101 // Notifications should be returned from the DB thread onto the UI thread.
101 message_loop_.RunAllPending(); 102 message_loop_.RunAllPending();
102 } 103 }
103 104
104 class TokenServiceTest : public TokenServiceTestHarness { 105 class TokenServiceTest : public TokenServiceTestHarness {
105 public: 106 public:
106 virtual void SetUp() { 107 virtual void SetUp() {
107 TokenServiceTestHarness::SetUp(); 108 TokenServiceTestHarness::SetUp();
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 450
450 *CommandLine::ForCurrentProcess() = original_cl; 451 *CommandLine::ForCurrentProcess() = original_cl;
451 } 452 }
452 }; 453 };
453 454
454 TEST_F(TokenServiceCommandLineTest, TestValueOverride) { 455 TEST_F(TokenServiceCommandLineTest, TestValueOverride) {
455 EXPECT_TRUE(service_.HasTokenForService("my_service")); 456 EXPECT_TRUE(service_.HasTokenForService("my_service"));
456 EXPECT_EQ("my_value", service_.GetTokenForService("my_service")); 457 EXPECT_EQ("my_value", service_.GetTokenForService("my_service"));
457 } 458 }
458 #endif // ifndef NDEBUG 459 #endif // ifndef NDEBUG
OLDNEW
« no previous file with comments | « chrome/browser/net/gaia/token_service_unittest.h ('k') | chrome/browser/password_manager/password_store_default_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698