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

Side by Side Diff: chrome/browser/geolocation/access_token_store_browsertest.cc

Issue 8873032: Removing MessageLoop::QuitTask() from chrome/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert 3 more problematic files Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/fast_shutdown_uitest.cc ('k') | chrome/browser/history/history_browsertest.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) 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 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/geolocation/chrome_access_token_store.h" 9 #include "chrome/browser/geolocation/chrome_access_token_store.h"
10 #include "chrome/test/base/in_process_browser_test.h" 10 #include "chrome/test/base/in_process_browser_test.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 &consumer, 88 &consumer,
89 base::Bind(&TokenLoadClientForTest::NotReachedCallback, 89 base::Bind(&TokenLoadClientForTest::NotReachedCallback,
90 base::Unretained(&load_client))); 90 base::Unretained(&load_client)));
91 EXPECT_TRUE(consumer.HasPendingRequests()); 91 EXPECT_TRUE(consumer.HasPendingRequests());
92 EXPECT_EQ(2u, consumer.PendingRequestCount()); 92 EXPECT_EQ(2u, consumer.PendingRequestCount());
93 consumer.CancelAllRequests(); 93 consumer.CancelAllRequests();
94 EXPECT_FALSE(consumer.HasPendingRequests()); 94 EXPECT_FALSE(consumer.HasPendingRequests());
95 EXPECT_EQ(0u, consumer.PendingRequestCount()); 95 EXPECT_EQ(0u, consumer.PendingRequestCount());
96 96
97 BrowserThread::PostTask( 97 BrowserThread::PostTask(
98 BrowserThread::UI, FROM_HERE, new MessageLoop::QuitTask); 98 BrowserThread::UI, FROM_HERE, MessageLoop::QuitClosure());
99 } 99 }
100 100
101 void GeolocationAccessTokenStoreTest::DoTestStepAndWaitForResults( 101 void GeolocationAccessTokenStoreTest::DoTestStepAndWaitForResults(
102 const char* ref_url, const string16* token_to_expect, 102 const char* ref_url, const string16* token_to_expect,
103 const string16* token_to_set) { 103 const string16* token_to_set) {
104 ref_url_ = GURL(ref_url); 104 ref_url_ = GURL(ref_url);
105 token_to_expect_ = token_to_expect; 105 token_to_expect_ = token_to_expect;
106 token_to_set_ = token_to_set; 106 token_to_set_ = token_to_set;
107 107
108 BrowserThread::PostTask( 108 BrowserThread::PostTask(
(...skipping 19 matching lines...) Expand all
128 } else { 128 } else {
129 EXPECT_FALSE(item == access_token_set.end()); 129 EXPECT_FALSE(item == access_token_set.end());
130 EXPECT_EQ(*token_to_expect_, item->second); 130 EXPECT_EQ(*token_to_expect_, item->second);
131 } 131 }
132 132
133 if (token_to_set_) { 133 if (token_to_set_) {
134 scoped_refptr<AccessTokenStore> store(new ChromeAccessTokenStore()); 134 scoped_refptr<AccessTokenStore> store(new ChromeAccessTokenStore());
135 store->SaveAccessToken(ref_url_, *token_to_set_); 135 store->SaveAccessToken(ref_url_, *token_to_set_);
136 } 136 }
137 BrowserThread::PostTask( 137 BrowserThread::PostTask(
138 BrowserThread::UI, FROM_HERE, new MessageLoop::QuitTask); 138 BrowserThread::UI, FROM_HERE, MessageLoop::QuitClosure());
139 } 139 }
140 140
141 IN_PROC_BROWSER_TEST_F(GeolocationAccessTokenStoreTest, SetAcrossInstances) { 141 IN_PROC_BROWSER_TEST_F(GeolocationAccessTokenStoreTest, SetAcrossInstances) {
142 const string16 ref_token1 = ASCIIToUTF16("jksdfo90,'s#\"#1*("); 142 const string16 ref_token1 = ASCIIToUTF16("jksdfo90,'s#\"#1*(");
143 const string16 ref_token2 = ASCIIToUTF16("\1\2\3\4\5\6\7\10\11\12=023"); 143 const string16 ref_token2 = ASCIIToUTF16("\1\2\3\4\5\6\7\10\11\12=023");
144 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); 144 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI));
145 145
146 DoTestStepAndWaitForResults(kRefServerUrl1, NULL, &ref_token1); 146 DoTestStepAndWaitForResults(kRefServerUrl1, NULL, &ref_token1);
147 // Check it was set, and change to new value. 147 // Check it was set, and change to new value.
148 DoTestStepAndWaitForResults(kRefServerUrl1, &ref_token1, &ref_token2); 148 DoTestStepAndWaitForResults(kRefServerUrl1, &ref_token1, &ref_token2);
(...skipping 20 matching lines...) Expand all
169 NULL, NULL); 169 NULL, NULL);
170 } 170 }
171 171
172 IN_PROC_BROWSER_TEST_F(GeolocationAccessTokenStoreTest, CancelRequest) { 172 IN_PROC_BROWSER_TEST_F(GeolocationAccessTokenStoreTest, CancelRequest) {
173 BrowserThread::PostTask(kExpectedClientThreadId, FROM_HERE, 173 BrowserThread::PostTask(kExpectedClientThreadId, FROM_HERE,
174 base::Bind(&RunCancelTestInClientTread)); 174 base::Bind(&RunCancelTestInClientTread));
175 ui_test_utils::RunMessageLoop(); 175 ui_test_utils::RunMessageLoop();
176 } 176 }
177 177
178 } // namespace 178 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/fast_shutdown_uitest.cc ('k') | chrome/browser/history/history_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698