Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mock_hasher.h
Go to the documentation of this file.
1 /*
2  * Copyright 2010 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 PAGESPEED_KERNEL_BASE_MOCK_HASHER_H_
20 #define PAGESPEED_KERNEL_BASE_MOCK_HASHER_H_
21 
26 
27 namespace net_instaweb {
28 
29 class MockHasher : public Hasher {
30  public:
32  : Hasher(kint32max),
33  hash_value_("\xd0") {
34  }
35  explicit MockHasher(StringPiece hash_value)
36  : Hasher(hash_value.size()),
37  hash_value_(hash_value.data(), hash_value.size()) {
38  }
39 
40  virtual ~MockHasher();
41 
42  virtual GoogleString RawHash(const StringPiece& content) const {
43  return hash_value_;
44  }
45 
46  void set_hash_value(const GoogleString& new_hash_value) {
47  hash_value_ = new_hash_value;
48  }
49 
50  virtual int RawHashSizeInBytes() const { return hash_value_.length(); }
51 
52  private:
53  GoogleString hash_value_;
54 
55 };
56 
57 }
58 
59 #endif
virtual GoogleString RawHash(const StringPiece &content) const
Definition: mock_hasher.h:42
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
virtual int RawHashSizeInBytes() const
The number of bytes RawHash will produce.
Definition: mock_hasher.h:50
Definition: hasher.h:30
Definition: mock_hasher.h:29
MockHasher()
Definition: mock_hasher.h:31