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

Side by Side Diff: net/cookies/cookie_store_test_helpers.cc

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « net/cookies/cookie_store_test_helpers.h ('k') | net/cookies/cookie_store_unittest.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "net/cookies/cookie_store_test_helpers.h"
6
7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h"
9
10 namespace net {
11
12 const int kDelayedTime = 0;
13
14 DelayedCookieMonster::DelayedCookieMonster()
15 : cookie_monster_(new CookieMonster(NULL, NULL)),
16 did_run_(false),
17 result_(false) {
18 }
19
20 DelayedCookieMonster::~DelayedCookieMonster() {
21 }
22
23 void DelayedCookieMonster::SetCookiesInternalCallback(bool result) {
24 result_ = result;
25 did_run_ = true;
26 }
27
28 void DelayedCookieMonster::GetCookiesWithOptionsInternalCallback(
29 const std::string& cookie) {
30 cookie_ = cookie;
31 did_run_ = true;
32 }
33
34 void DelayedCookieMonster::SetCookieWithOptionsAsync(
35 const GURL& url,
36 const std::string& cookie_line,
37 const CookieOptions& options,
38 const CookieMonster::SetCookiesCallback& callback) {
39 did_run_ = false;
40 cookie_monster_->SetCookieWithOptionsAsync(
41 url, cookie_line, options,
42 base::Bind(&DelayedCookieMonster::SetCookiesInternalCallback,
43 base::Unretained(this)));
44 DCHECK_EQ(did_run_, true);
45 base::MessageLoop::current()->PostDelayedTask(
46 FROM_HERE,
47 base::Bind(&DelayedCookieMonster::InvokeSetCookiesCallback,
48 base::Unretained(this),
49 callback),
50 base::TimeDelta::FromMilliseconds(kDelayedTime));
51 }
52
53 void DelayedCookieMonster::GetCookiesWithOptionsAsync(
54 const GURL& url,
55 const CookieOptions& options,
56 const CookieMonster::GetCookiesCallback& callback) {
57 did_run_ = false;
58 cookie_monster_->GetCookiesWithOptionsAsync(
59 url, options,
60 base::Bind(&DelayedCookieMonster::GetCookiesWithOptionsInternalCallback,
61 base::Unretained(this)));
62 DCHECK_EQ(did_run_, true);
63 base::MessageLoop::current()->PostDelayedTask(
64 FROM_HERE,
65 base::Bind(&DelayedCookieMonster::InvokeGetCookieStringCallback,
66 base::Unretained(this),
67 callback),
68 base::TimeDelta::FromMilliseconds(kDelayedTime));
69 }
70
71 void DelayedCookieMonster::GetAllCookiesForURLAsync(
72 const GURL& url,
73 const GetCookieListCallback& callback) {
74 cookie_monster_->GetAllCookiesForURLAsync(url, callback);
75 }
76
77 void DelayedCookieMonster::InvokeSetCookiesCallback(
78 const CookieMonster::SetCookiesCallback& callback) {
79 if (!callback.is_null())
80 callback.Run(result_);
81 }
82
83 void DelayedCookieMonster::InvokeGetCookieStringCallback(
84 const CookieMonster::GetCookiesCallback& callback) {
85 if (!callback.is_null())
86 callback.Run(cookie_);
87 }
88
89 bool DelayedCookieMonster::SetCookieWithOptions(
90 const GURL& url,
91 const std::string& cookie_line,
92 const CookieOptions& options) {
93 ADD_FAILURE();
94 return false;
95 }
96
97 std::string DelayedCookieMonster::GetCookiesWithOptions(
98 const GURL& url,
99 const CookieOptions& options) {
100 ADD_FAILURE();
101 return std::string();
102 }
103
104 void DelayedCookieMonster::DeleteCookie(const GURL& url,
105 const std::string& cookie_name) {
106 ADD_FAILURE();
107 }
108
109 void DelayedCookieMonster::DeleteCookieAsync(const GURL& url,
110 const std::string& cookie_name,
111 const base::Closure& callback) {
112 ADD_FAILURE();
113 }
114
115 void DelayedCookieMonster::DeleteAllCreatedBetweenAsync(
116 const base::Time& delete_begin,
117 const base::Time& delete_end,
118 const DeleteCallback& callback) {
119 ADD_FAILURE();
120 }
121
122 void DelayedCookieMonster::DeleteAllCreatedBetweenForHostAsync(
123 const base::Time delete_begin,
124 const base::Time delete_end,
125 const GURL& url,
126 const DeleteCallback& callback) {
127 ADD_FAILURE();
128 }
129
130 void DelayedCookieMonster::DeleteSessionCookiesAsync(const DeleteCallback&) {
131 ADD_FAILURE();
132 }
133
134 CookieMonster* DelayedCookieMonster::GetCookieMonster() {
135 return cookie_monster_.get();
136 }
137
138 scoped_ptr<CookieStore::CookieChangedSubscription>
139 DelayedCookieMonster::AddCallbackForCookie(
140 const GURL& url,
141 const std::string& name,
142 const CookieChangedCallback& callback) {
143 ADD_FAILURE();
144 return scoped_ptr<CookieStore::CookieChangedSubscription>();
145 }
146
147 } // namespace net
OLDNEW
« no previous file with comments | « net/cookies/cookie_store_test_helpers.h ('k') | net/cookies/cookie_store_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698