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

Side by Side Diff: chromeos/login/auth/mock_url_fetchers.h

Issue 402403004: Refactoring : Move OnlineAttempt to chromeos/login (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_MOCK_URL_FETCHERS_H_ 5 #ifndef CHROMEOS_LOGIN_AUTH_MOCK_URL_FETCHERS_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_MOCK_URL_FETCHERS_H_ 6 #define CHROMEOS_LOGIN_AUTH_MOCK_URL_FETCHERS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "chromeos/chromeos_export.h"
13 #include "net/url_request/test_url_fetcher_factory.h" 14 #include "net/url_request/test_url_fetcher_factory.h"
14 #include "net/url_request/url_request_status.h" 15 #include "net/url_request/url_request_status.h"
15 #include "url/gurl.h" 16 #include "url/gurl.h"
16 17
17 namespace net { 18 namespace net {
18 class URLFetcherDelegate; 19 class URLFetcherDelegate;
19 } 20 }
20 21
21 namespace chromeos { 22 namespace chromeos {
22 23
23 // Simulates a URL fetch by posting a delayed task. This fetch expects to be 24 // Simulates a URL fetch by posting a delayed task. This fetch expects to be
24 // canceled, and fails the test if it is not 25 // canceled, and fails the test if it is not
25 class ExpectCanceledFetcher : public net::TestURLFetcher { 26 class CHROMEOS_EXPORT ExpectCanceledFetcher : public net::TestURLFetcher {
Nikita (slow) 2014/07/22 14:23:56 You should drop CHROMEOS_EXPORT for these classes
Denis Kuznetsov (DE-MUC) 2014/07/22 15:41:31 Done.
26 public: 27 public:
27 ExpectCanceledFetcher(bool success, 28 ExpectCanceledFetcher(bool success,
28 const GURL& url, 29 const GURL& url,
29 const std::string& results, 30 const std::string& results,
30 net::URLFetcher::RequestType request_type, 31 net::URLFetcher::RequestType request_type,
31 net::URLFetcherDelegate* d); 32 net::URLFetcherDelegate* d);
32 virtual ~ExpectCanceledFetcher(); 33 virtual ~ExpectCanceledFetcher();
33 34
34 virtual void Start() OVERRIDE; 35 virtual void Start() OVERRIDE;
35 36
36 void CompleteFetch(); 37 void CompleteFetch();
37 38
38 private: 39 private:
39 base::WeakPtrFactory<ExpectCanceledFetcher> weak_factory_; 40 base::WeakPtrFactory<ExpectCanceledFetcher> weak_factory_;
40 DISALLOW_COPY_AND_ASSIGN(ExpectCanceledFetcher); 41 DISALLOW_COPY_AND_ASSIGN(ExpectCanceledFetcher);
41 }; 42 };
42 43
43 class GotCanceledFetcher : public net::TestURLFetcher { 44 class CHROMEOS_EXPORT GotCanceledFetcher : public net::TestURLFetcher {
44 public: 45 public:
45 GotCanceledFetcher(bool success, 46 GotCanceledFetcher(bool success,
46 const GURL& url, 47 const GURL& url,
47 const std::string& results, 48 const std::string& results,
48 net::URLFetcher::RequestType request_type, 49 net::URLFetcher::RequestType request_type,
49 net::URLFetcherDelegate* d); 50 net::URLFetcherDelegate* d);
50 virtual ~GotCanceledFetcher(); 51 virtual ~GotCanceledFetcher();
51 52
52 virtual void Start() OVERRIDE; 53 virtual void Start() OVERRIDE;
53 54
54 private: 55 private:
55 DISALLOW_COPY_AND_ASSIGN(GotCanceledFetcher); 56 DISALLOW_COPY_AND_ASSIGN(GotCanceledFetcher);
56 }; 57 };
57 58
58 class SuccessFetcher : public net::TestURLFetcher { 59 class CHROMEOS_EXPORT SuccessFetcher : public net::TestURLFetcher {
59 public: 60 public:
60 SuccessFetcher(bool success, 61 SuccessFetcher(bool success,
61 const GURL& url, 62 const GURL& url,
62 const std::string& results, 63 const std::string& results,
63 net::URLFetcher::RequestType request_type, 64 net::URLFetcher::RequestType request_type,
64 net::URLFetcherDelegate* d); 65 net::URLFetcherDelegate* d);
65 virtual ~SuccessFetcher(); 66 virtual ~SuccessFetcher();
66 67
67 virtual void Start() OVERRIDE; 68 virtual void Start() OVERRIDE;
68 69
69 private: 70 private:
70 DISALLOW_COPY_AND_ASSIGN(SuccessFetcher); 71 DISALLOW_COPY_AND_ASSIGN(SuccessFetcher);
71 }; 72 };
72 73
73 class FailFetcher : public net::TestURLFetcher { 74 class CHROMEOS_EXPORT FailFetcher : public net::TestURLFetcher {
74 public: 75 public:
75 FailFetcher(bool success, 76 FailFetcher(bool success,
76 const GURL& url, 77 const GURL& url,
77 const std::string& results, 78 const std::string& results,
78 net::URLFetcher::RequestType request_type, 79 net::URLFetcher::RequestType request_type,
79 net::URLFetcherDelegate* d); 80 net::URLFetcherDelegate* d);
80 virtual ~FailFetcher(); 81 virtual ~FailFetcher();
81 82
82 virtual void Start() OVERRIDE; 83 virtual void Start() OVERRIDE;
83 84
84 private: 85 private:
85 DISALLOW_COPY_AND_ASSIGN(FailFetcher); 86 DISALLOW_COPY_AND_ASSIGN(FailFetcher);
86 }; 87 };
87 88
88 class CaptchaFetcher : public net::TestURLFetcher { 89 class CHROMEOS_EXPORT CaptchaFetcher : public net::TestURLFetcher {
89 public: 90 public:
90 CaptchaFetcher(bool success, 91 CaptchaFetcher(bool success,
91 const GURL& url, 92 const GURL& url,
92 const std::string& results, 93 const std::string& results,
93 net::URLFetcher::RequestType request_type, 94 net::URLFetcher::RequestType request_type,
94 net::URLFetcherDelegate* d); 95 net::URLFetcherDelegate* d);
95 virtual ~CaptchaFetcher(); 96 virtual ~CaptchaFetcher();
96 97
97 static std::string GetCaptchaToken(); 98 static std::string GetCaptchaToken();
98 static std::string GetCaptchaUrl(); 99 static std::string GetCaptchaUrl();
99 static std::string GetUnlockUrl(); 100 static std::string GetUnlockUrl();
100 101
101 virtual void Start() OVERRIDE; 102 virtual void Start() OVERRIDE;
102 103
103 private: 104 private:
104 static const char kCaptchaToken[]; 105 static const char kCaptchaToken[];
105 static const char kCaptchaUrlBase[]; 106 static const char kCaptchaUrlBase[];
106 static const char kCaptchaUrlFragment[]; 107 static const char kCaptchaUrlFragment[];
107 static const char kUnlockUrl[]; 108 static const char kUnlockUrl[];
108 DISALLOW_COPY_AND_ASSIGN(CaptchaFetcher); 109 DISALLOW_COPY_AND_ASSIGN(CaptchaFetcher);
109 }; 110 };
110 111
111 class HostedFetcher : public net::TestURLFetcher { 112 class CHROMEOS_EXPORT HostedFetcher : public net::TestURLFetcher {
112 public: 113 public:
113 HostedFetcher(bool success, 114 HostedFetcher(bool success,
114 const GURL& url, 115 const GURL& url,
115 const std::string& results, 116 const std::string& results,
116 net::URLFetcher::RequestType request_type, 117 net::URLFetcher::RequestType request_type,
117 net::URLFetcherDelegate* d); 118 net::URLFetcherDelegate* d);
118 virtual ~HostedFetcher(); 119 virtual ~HostedFetcher();
119 120
120 virtual void Start() OVERRIDE; 121 virtual void Start() OVERRIDE;
121 122
122 private: 123 private:
123 DISALLOW_COPY_AND_ASSIGN(HostedFetcher); 124 DISALLOW_COPY_AND_ASSIGN(HostedFetcher);
124 }; 125 };
125 126
126 } // namespace chromeos 127 } // namespace chromeos
127 128
128 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_MOCK_URL_FETCHERS_H_ 129 #endif // CHROMEOS_LOGIN_AUTH_MOCK_URL_FETCHERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698