Page Speed Optimization Libraries  1.9.32.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mock_critical_css_finder.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_MOCK_CRITICAL_CSS_FINDER_H_
19 #define NET_INSTAWEB_REWRITER_PUBLIC_MOCK_CRITICAL_CSS_FINDER_H_
20 
21 #include <cstddef>
22 
24 #include "pagespeed/kernel/base/scoped_ptr.h"
25 #include "pagespeed/kernel/base/string_util.h"
26 
27 namespace net_instaweb {
28 
29 class RewriteDriver;
30 class CriticalCssResult;
31 class Statistics;
32 
36  public:
37  MockCriticalCssFinder(RewriteDriver* driver, Statistics* stats)
38  : CriticalCssFinder(NULL, stats), driver_(driver) {}
39  virtual ~MockCriticalCssFinder();
40 
41  void AddCriticalCss(const StringPiece& url, const StringPiece& rules,
42  int original_size);
43 
44  void SetCriticalCssStats(
45  int exception_count, int import_count, int link_count);
46 
48  virtual CriticalCssResult* GetCriticalCssFromCache(RewriteDriver* driver);
49 
50  virtual void ComputeCriticalCss(RewriteDriver* driver) {}
51 
52  private:
53  RewriteDriver* driver_;
54  scoped_ptr<CriticalCssResult> critical_css_result_;
55 };
56 
57 }
58 
59 #endif
virtual void ComputeCriticalCss(RewriteDriver *driver)
Compute the critical css for the driver's url.
Definition: mock_critical_css_finder.h:50
Finds critical CSS rules (i.e. CSS needed for the initial page load).
Definition: critical_css_finder.h:33
virtual CriticalCssResult * GetCriticalCssFromCache(RewriteDriver *driver)
Mock to avoid dealing with property cache.
Definition: rewrite_driver.h:98
Definition: mock_critical_css_finder.h:35