Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
critical_images_finder_test_base.h
Go to the documentation of this file.
1 /*
2  * Copyright 2012 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  */
17 
18 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_CRITICAL_IMAGES_FINDER_TEST_BASE_H_
19 #define NET_INSTAWEB_REWRITER_PUBLIC_CRITICAL_IMAGES_FINDER_TEST_BASE_H_
20 
23 #include "net/instaweb/util/public/property_cache.h"
26 
27 namespace net_instaweb {
28 
29 class RewriteDriver;
30 class Statistics;
31 
35  public:
37  Statistics* stats)
38  : CriticalImagesFinder(cohort, stats),
39  available_(kAvailable) {}
40  virtual ~TestCriticalImagesFinder();
42  return available_;
43  }
44  void set_available(Availability available) {
45  available_ = available;
46  }
47  virtual void ComputeCriticalImages(RewriteDriver* driver) {}
48  private:
49  Availability available_;
50 };
51 
53  public:
54  virtual CriticalImagesFinder* finder() = 0;
55 
56  virtual bool UpdateCriticalImagesCacheEntry(
57  const StringSet* critical_images_set,
58  const StringSet* css_critical_images_set) {
60  critical_images_set, css_critical_images_set, rewrite_driver());
61  }
62 
63  void CheckCriticalImageFinderStats(int hits, int expiries, int not_found);
64 
65  bool IsHtmlCriticalImage(StringPiece url);
66  bool IsCssCriticalImage(StringPiece url);
67 
68  protected:
69  NullStatistics stats_;
70 
72  void ResetDriver();
73 
74  const PropertyValue* GetCriticalImagesUpdatedValue();
75 
76  private:
77  static const char kRequestUrl[];
78 };
79 
80 }
81 
82 #endif
virtual Availability Available(RewriteDriver *driver)
Definition: critical_images_finder_test_base.h:41
void ResetDriver()
Resets the state of the driver.
Holds the value & stability-metadata for a property.
Definition: property_cache.h:122
Definition: property_cache.h:186
Definition: critical_images_finder.h:65
Base class for implementations of monitoring statistics.
Definition: statistics.h:342
Definition: rewrite_test_base.h:90
RewriteDriver * rewrite_driver()
Definition: rewrite_test_base.h:517
Definition: critical_images_finder_test_base.h:34
const PropertyCache::Cohort * cohort() const
Definition: critical_images_finder.h:152
Availability
Definition: critical_images_finder.h:67
Data is available.
Definition: critical_images_finder.h:70
Definition: rewrite_driver.h:100
bool UpdateCriticalImagesCacheEntryFromDriver(const StringSet *html_critical_images_set, const StringSet *css_critical_images_set, RewriteDriver *driver)
virtual void ComputeCriticalImages(RewriteDriver *driver)
Compute the critical images for the driver's url.
Definition: critical_images_finder_test_base.h:47
Definition: critical_images_finder_test_base.h:52
Simple name/value pair statistics implementation.
Definition: null_statistics.h:44