Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
disable_test_filter.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014 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_HTML_DISABLED_TEST_FILTER_H_
20 #define PAGESPEED_KERNEL_HTML_DISABLED_TEST_FILTER_H_
21 
26 
27 namespace net_instaweb {
28 
30  public:
31  DisableTestFilter(const GoogleString& name, bool is_enabled,
32  const GoogleString& disabled_reason)
33  : name_(name),
34  is_enabled_(is_enabled),
35  disabled_reason_(disabled_reason) {}
36 
37  virtual void DetermineEnabled(GoogleString* disabled_reason) {
38  set_is_enabled(is_enabled_);
42  *disabled_reason = disabled_reason_;
43  }
44 
45  GoogleString ExpectedDisabledMessage() const {
46  GoogleString message(Name());
47  if (!disabled_reason_.empty()) {
48  StrAppend(&message, ": ", disabled_reason_);
49  }
50  return message;
51  }
52 
53  virtual const char* Name() const { return name_.c_str(); }
54 
55  private:
56  GoogleString name_;
57  bool is_enabled_;
58  GoogleString disabled_reason_;
59 
60 
61 };
62 
63 }
64 
65 #endif
Definition: disable_test_filter.h:29
Definition: empty_html_filter.h:37
void set_is_enabled(bool is_enabled)
Definition: html_filter.h:131
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
bool is_enabled() const
Definition: html_filter.h:125
virtual void DetermineEnabled(GoogleString *disabled_reason)
Definition: disable_test_filter.h:37
virtual const char * Name() const
The name of this filter – used for logging and debugging.
Definition: disable_test_filter.h:53