OLD | NEW |
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } else { | 93 } else { |
94 EXPECT_FALSE(item == access_token_set.end()); | 94 EXPECT_FALSE(item == access_token_set.end()); |
95 EXPECT_EQ(*token_to_expect_, item->second); | 95 EXPECT_EQ(*token_to_expect_, item->second); |
96 } | 96 } |
97 | 97 |
98 if (token_to_set_) { | 98 if (token_to_set_) { |
99 scoped_refptr<AccessTokenStore> store(new ChromeAccessTokenStore()); | 99 scoped_refptr<AccessTokenStore> store(new ChromeAccessTokenStore()); |
100 store->SaveAccessToken(ref_url_, *token_to_set_); | 100 store->SaveAccessToken(ref_url_, *token_to_set_); |
101 } | 101 } |
102 BrowserThread::PostTask( | 102 BrowserThread::PostTask( |
103 BrowserThread::UI, FROM_HERE, MessageLoop::QuitClosure()); | 103 BrowserThread::UI, FROM_HERE, base::MessageLoop::QuitClosure()); |
104 } | 104 } |
105 | 105 |
106 IN_PROC_BROWSER_TEST_F(GeolocationAccessTokenStoreTest, SetAcrossInstances) { | 106 IN_PROC_BROWSER_TEST_F(GeolocationAccessTokenStoreTest, SetAcrossInstances) { |
107 const string16 ref_token1 = ASCIIToUTF16("jksdfo90,'s#\"#1*("); | 107 const string16 ref_token1 = ASCIIToUTF16("jksdfo90,'s#\"#1*("); |
108 const string16 ref_token2 = ASCIIToUTF16("\1\2\3\4\5\6\7\10\11\12=023"); | 108 const string16 ref_token2 = ASCIIToUTF16("\1\2\3\4\5\6\7\10\11\12=023"); |
109 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 109 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
110 | 110 |
111 DoTestStepAndWaitForResults(kRefServerUrl1, NULL, &ref_token1); | 111 DoTestStepAndWaitForResults(kRefServerUrl1, NULL, &ref_token1); |
112 // Check it was set, and change to new value. | 112 // Check it was set, and change to new value. |
113 DoTestStepAndWaitForResults(kRefServerUrl1, &ref_token1, &ref_token2); | 113 DoTestStepAndWaitForResults(kRefServerUrl1, &ref_token1, &ref_token2); |
(...skipping 14 matching lines...) Expand all Loading... |
128 // Set a token for the old default network provider url. | 128 // Set a token for the old default network provider url. |
129 DoTestStepAndWaitForResults(kOldDefaultNetworkProviderUrl, | 129 DoTestStepAndWaitForResults(kOldDefaultNetworkProviderUrl, |
130 NULL, &ref_token1); | 130 NULL, &ref_token1); |
131 // Check that the token related to the old default network provider url | 131 // Check that the token related to the old default network provider url |
132 // was deleted. | 132 // was deleted. |
133 DoTestStepAndWaitForResults(kOldDefaultNetworkProviderUrl, | 133 DoTestStepAndWaitForResults(kOldDefaultNetworkProviderUrl, |
134 NULL, NULL); | 134 NULL, NULL); |
135 } | 135 } |
136 | 136 |
137 } // namespace | 137 } // namespace |
OLD | NEW |