| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/renderer/prerender/prerender_dispatcher.h" | 5 #include "chrome/renderer/prerender/prerender_dispatcher.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 14 | 14 |
| 15 namespace prerender { | 15 namespace prerender { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 int g_next_prerender_id = 0; | 19 int g_next_prerender_id = 0; |
| 20 | 20 |
| 21 } // namespace | 21 } // namespace |
| 22 | 22 |
| 23 using WebKit::WebPrerender; | 23 using blink::WebPrerender; |
| 24 | 24 |
| 25 // Since we can't mock out WebKit::WebPrerender in chrome, this test can't test | 25 // Since we can't mock out blink::WebPrerender in chrome, this test can't test |
| 26 // signalling to or from the WebKit side. Instead, it checks only that the | 26 // signalling to or from the WebKit side. Instead, it checks only that the |
| 27 // messages received from the browser generate consistant state in the | 27 // messages received from the browser generate consistant state in the |
| 28 // PrerenderDispatcher. Since prerenders couldn't even start or stop without the | 28 // PrerenderDispatcher. Since prerenders couldn't even start or stop without the |
| 29 // WebKit signalling, we can expect PrerenderBrowserTest to provide adequate | 29 // WebKit signalling, we can expect PrerenderBrowserTest to provide adequate |
| 30 // coverage of this. | 30 // coverage of this. |
| 31 class PrerenderDispatcherTest : public testing::Test { | 31 class PrerenderDispatcherTest : public testing::Test { |
| 32 public: | 32 public: |
| 33 PrerenderDispatcherTest() {} | 33 PrerenderDispatcherTest() {} |
| 34 | 34 |
| 35 bool IsPrerenderURL(const GURL& url) const { | 35 bool IsPrerenderURL(const GURL& url) const { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 EXPECT_EQ(2, GetCountForURL(foo_url)); | 146 EXPECT_EQ(2, GetCountForURL(foo_url)); |
| 147 RemoveAliasFromPrerender(foo_url); | 147 RemoveAliasFromPrerender(foo_url); |
| 148 EXPECT_TRUE(IsPrerenderURL(foo_url)); | 148 EXPECT_TRUE(IsPrerenderURL(foo_url)); |
| 149 EXPECT_EQ(1, GetCountForURL(foo_url)); | 149 EXPECT_EQ(1, GetCountForURL(foo_url)); |
| 150 RemoveAliasFromPrerender(foo_url); | 150 RemoveAliasFromPrerender(foo_url); |
| 151 EXPECT_FALSE(IsPrerenderURL(foo_url)); | 151 EXPECT_FALSE(IsPrerenderURL(foo_url)); |
| 152 EXPECT_EQ(0, GetCountForURL(foo_url)); | 152 EXPECT_EQ(0, GetCountForURL(foo_url)); |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // end namespace prerender | 155 } // end namespace prerender |
| OLD | NEW |