Page Speed Optimization Libraries  1.9.32.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
test_distributed_fetcher.h
Go to the documentation of this file.
1 /*
2  * Copyright 2013 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
19 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_TEST_DISTRIBUTED_FETCHER_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_TEST_DISTRIBUTED_FETCHER_H_
21 
25 
26 namespace net_instaweb {
27 
28 class AsyncFetch;
29 class MessageHandler;
30 
31 class RewriteTestBase;
32 
38  public:
39  explicit TestDistributedFetcher(RewriteTestBase* test_base);
40  virtual ~TestDistributedFetcher();
41  virtual void Fetch(const GoogleString& url, MessageHandler* message_handler,
42  AsyncFetch* fetch);
43 
46  void set_fail_after_headers(bool x) { fail_after_headers_ = x; }
47 
50  error_before_headers_complete_ = x;
51  }
52 
56  void set_blocking_fetch(bool x) { blocking_fetch_ = x; }
57 
58  private:
59  class TestDistributedFetch;
60  RewriteTestBase* rewrite_test_base_;
61  bool fail_after_headers_;
62  bool blocking_fetch_;
63  bool error_before_headers_complete_;
64  DISALLOW_COPY_AND_ASSIGN(TestDistributedFetcher);
65 };
66 
67 }
68 
69 #endif
void set_blocking_fetch(bool x)
Definition: test_distributed_fetcher.h:56
Definition: rewrite_test_base.h:88
void set_fail_after_headers(bool x)
Definition: test_distributed_fetcher.h:46
virtual void Fetch(const GoogleString &url, MessageHandler *message_handler, AsyncFetch *fetch)
Definition: test_distributed_fetcher.h:37
Definition: async_fetch.h:53
void set_error_before_headers_complete(bool x)
If true, simulates an error before headers complete.
Definition: test_distributed_fetcher.h:49
Definition: url_async_fetcher.h:33