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

Side by Side Diff: chrome/browser/chromeos/login/mock_url_fetchers.h

Issue 286933002: [cros login] Split login related classes into subfolders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix includes in new tests Created 6 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_URL_FETCHERS_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_URL_FETCHERS_H_
7
8 #include <string>
9
10 #include "base/compiler_specific.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/message_loop/message_loop.h"
13 #include "net/url_request/test_url_fetcher_factory.h"
14 #include "net/url_request/url_request_status.h"
15 #include "url/gurl.h"
16
17 namespace net {
18 class URLFetcherDelegate;
19 }
20
21 namespace chromeos {
22
23 // 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 class ExpectCanceledFetcher : public net::TestURLFetcher {
26 public:
27 ExpectCanceledFetcher(bool success,
28 const GURL& url,
29 const std::string& results,
30 net::URLFetcher::RequestType request_type,
31 net::URLFetcherDelegate* d);
32 virtual ~ExpectCanceledFetcher();
33
34 virtual void Start() OVERRIDE;
35
36 void CompleteFetch();
37
38 private:
39 base::WeakPtrFactory<ExpectCanceledFetcher> weak_factory_;
40 DISALLOW_COPY_AND_ASSIGN(ExpectCanceledFetcher);
41 };
42
43 class GotCanceledFetcher : public net::TestURLFetcher {
44 public:
45 GotCanceledFetcher(bool success,
46 const GURL& url,
47 const std::string& results,
48 net::URLFetcher::RequestType request_type,
49 net::URLFetcherDelegate* d);
50 virtual ~GotCanceledFetcher();
51
52 virtual void Start() OVERRIDE;
53
54 private:
55 DISALLOW_COPY_AND_ASSIGN(GotCanceledFetcher);
56 };
57
58 class SuccessFetcher : public net::TestURLFetcher {
59 public:
60 SuccessFetcher(bool success,
61 const GURL& url,
62 const std::string& results,
63 net::URLFetcher::RequestType request_type,
64 net::URLFetcherDelegate* d);
65 virtual ~SuccessFetcher();
66
67 virtual void Start() OVERRIDE;
68
69 private:
70 DISALLOW_COPY_AND_ASSIGN(SuccessFetcher);
71 };
72
73 class FailFetcher : public net::TestURLFetcher {
74 public:
75 FailFetcher(bool success,
76 const GURL& url,
77 const std::string& results,
78 net::URLFetcher::RequestType request_type,
79 net::URLFetcherDelegate* d);
80 virtual ~FailFetcher();
81
82 virtual void Start() OVERRIDE;
83
84 private:
85 DISALLOW_COPY_AND_ASSIGN(FailFetcher);
86 };
87
88 class CaptchaFetcher : public net::TestURLFetcher {
89 public:
90 CaptchaFetcher(bool success,
91 const GURL& url,
92 const std::string& results,
93 net::URLFetcher::RequestType request_type,
94 net::URLFetcherDelegate* d);
95 virtual ~CaptchaFetcher();
96
97 static std::string GetCaptchaToken();
98 static std::string GetCaptchaUrl();
99 static std::string GetUnlockUrl();
100
101 virtual void Start() OVERRIDE;
102
103 private:
104 static const char kCaptchaToken[];
105 static const char kCaptchaUrlBase[];
106 static const char kCaptchaUrlFragment[];
107 static const char kUnlockUrl[];
108 DISALLOW_COPY_AND_ASSIGN(CaptchaFetcher);
109 };
110
111 class HostedFetcher : public net::TestURLFetcher {
112 public:
113 HostedFetcher(bool success,
114 const GURL& url,
115 const std::string& results,
116 net::URLFetcher::RequestType request_type,
117 net::URLFetcherDelegate* d);
118 virtual ~HostedFetcher();
119
120 virtual void Start() OVERRIDE;
121
122 private:
123 DISALLOW_COPY_AND_ASSIGN(HostedFetcher);
124 };
125
126 } // namespace chromeos
127
128 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_URL_FETCHERS_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/mock_login_utils.h ('k') | chrome/browser/chromeos/login/mock_url_fetchers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698