Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mock_critical_images_finder.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  */
17 
18 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_MOCK_CRITICAL_IMAGES_FINDER_H_
19 #define NET_INSTAWEB_REWRITER_PUBLIC_MOCK_CRITICAL_IMAGES_FINDER_H_
20 
23 #include "net/instaweb/rewriter/rendered_image.pb.h"
24 #include "net/instaweb/util/public/property_cache.h"
28 
29 namespace net_instaweb {
30 
31 class RewriteDriver;
32 class Statistics;
33 
37  public:
38  explicit MockCriticalImagesFinder(Statistics* stats)
39  : TestCriticalImagesFinder(NULL, stats), compute_calls_(0) {}
40 
42  Statistics* stats)
43  : TestCriticalImagesFinder(cohort, stats), compute_calls_(0) {}
44 
46 
48  return kAvailable;
49  }
50 
51  virtual void UpdateCriticalImagesSetInDriver(RewriteDriver* driver);
52 
54  virtual RenderedImages* ExtractRenderedImageDimensionsFromCache(
55  RewriteDriver* driver);
56 
57  virtual void ComputeCriticalImages(RewriteDriver* driver) {
58  ++compute_calls_;
59  }
60 
61  int num_compute_calls() { return compute_calls_; }
62 
63  void set_critical_images(StringSet* critical_images) {
64  critical_images_.reset(critical_images);
65  }
66 
67  void set_css_critical_images(StringSet* css_critical_images) {
68  css_critical_images_.reset(css_critical_images);
69  }
70 
71  void set_rendered_images(RenderedImages* rendered_images) {
72  rendered_images_.reset(rendered_images);
73  }
74 
75  virtual bool IsCriticalImageInfoPresent(RewriteDriver* driver) {
76  return true;
77  }
78 
79  private:
80  int compute_calls_;
81  scoped_ptr<StringSet> critical_images_;
82  scoped_ptr<StringSet> css_critical_images_;
83  scoped_ptr<RenderedImages> rendered_images_;
84 
85 };
86 
87 }
88 
89 #endif
Definition: property_cache.h:186
virtual bool IsCriticalImageInfoPresent(RewriteDriver *driver)
Definition: mock_critical_images_finder.h:75
Base class for implementations of monitoring statistics.
Definition: statistics.h:342
Definition: critical_images_finder_test_base.h:34
const PropertyCache::Cohort * cohort() const
Definition: critical_images_finder.h:152
virtual Availability Available(RewriteDriver *driver)
Definition: mock_critical_images_finder.h:47
Availability
Definition: critical_images_finder.h:67
virtual void UpdateCriticalImagesSetInDriver(RewriteDriver *driver)
Data is available.
Definition: critical_images_finder.h:70
Definition: rewrite_driver.h:100
virtual void ComputeCriticalImages(RewriteDriver *driver)
Compute the critical images for the driver's url.
Definition: mock_critical_images_finder.h:57
virtual RenderedImages * ExtractRenderedImageDimensionsFromCache(RewriteDriver *driver)
Extracts rendered image dimensions from property cache.
Definition: mock_critical_images_finder.h:36