OLD | NEW |
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 // A complete set of unit tests for OAuth2RevocationFetcher. | 5 // A complete set of unit tests for OAuth2RevocationFetcher. |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 class MockOAuth2RevocationConsumer : public OAuth2RevocationConsumer { | 55 class MockOAuth2RevocationConsumer : public OAuth2RevocationConsumer { |
56 public: | 56 public: |
57 MockOAuth2RevocationConsumer() {} | 57 MockOAuth2RevocationConsumer() {} |
58 ~MockOAuth2RevocationConsumer() {} | 58 ~MockOAuth2RevocationConsumer() {} |
59 | 59 |
60 MOCK_METHOD0(OnRevocationSuccess, void()); | 60 MOCK_METHOD0(OnRevocationSuccess, void()); |
61 MOCK_METHOD1(OnRevocationFailure, | 61 MOCK_METHOD1(OnRevocationFailure, |
62 void(const GoogleServiceAuthError& error)); | 62 void(const GoogleServiceAuthError& error)); |
63 }; | 63 }; |
64 | 64 |
65 } | 65 } // namespace |
66 | 66 |
67 class OAuth2RevocationFetcherTest : public testing::Test { | 67 class OAuth2RevocationFetcherTest : public testing::Test { |
68 public: | 68 public: |
69 OAuth2RevocationFetcherTest() | 69 OAuth2RevocationFetcherTest() |
70 : ui_thread_(BrowserThread::UI, &message_loop_), | 70 : ui_thread_(BrowserThread::UI, &message_loop_), |
71 fetcher_(&consumer_, profile_.GetRequestContext()) { | 71 fetcher_(&consumer_, profile_.GetRequestContext()) { |
72 } | 72 } |
73 | 73 |
74 virtual ~OAuth2RevocationFetcherTest() { } | 74 virtual ~OAuth2RevocationFetcherTest() { } |
75 | 75 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 fetcher_.Start("access_token", "client_id", "origin"); | 111 fetcher_.Start("access_token", "client_id", "origin"); |
112 fetcher_.OnURLFetchComplete(url_fetcher); | 112 fetcher_.OnURLFetchComplete(url_fetcher); |
113 } | 113 } |
114 | 114 |
115 TEST_F(OAuth2RevocationFetcherTest, Success) { | 115 TEST_F(OAuth2RevocationFetcherTest, Success) { |
116 TestURLFetcher* url_fetcher = SetupRevocation(true, net::HTTP_NO_CONTENT); | 116 TestURLFetcher* url_fetcher = SetupRevocation(true, net::HTTP_NO_CONTENT); |
117 EXPECT_CALL(consumer_, OnRevocationSuccess()).Times(1); | 117 EXPECT_CALL(consumer_, OnRevocationSuccess()).Times(1); |
118 fetcher_.Start("access_token", "client_id", "origin"); | 118 fetcher_.Start("access_token", "client_id", "origin"); |
119 fetcher_.OnURLFetchComplete(url_fetcher); | 119 fetcher_.OnURLFetchComplete(url_fetcher); |
120 } | 120 } |
OLD | NEW |