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 "base/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "chrome/browser/prerender/prerender_manager.h" | 6 #include "chrome/browser/prerender/prerender_manager.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "content/public/test/test_browser_thread.h" | 8 #include "content/public/test/test_browser_thread.h" |
9 | 9 |
10 | 10 |
11 namespace prerender { | 11 namespace prerender { |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 // These tests don't require the dummy PrerenderContents & PrerenderManager that | 15 // These tests don't require the dummy PrerenderContents & PrerenderManager that |
16 // the heavier PrerenderTest.* tests do. | 16 // the heavier PrerenderTest.* tests do. |
17 class PrerenderManagerTest : public testing::Test { | 17 class PrerenderManagerTest : public testing::Test { |
18 public: | 18 public: |
19 PrerenderManagerTest() | 19 PrerenderManagerTest() |
20 : ui_thread_(content::BrowserThread::UI, &message_loop_), | 20 : ui_thread_(content::BrowserThread::UI, &message_loop_), |
21 prerender_manager_(NULL, NULL) { | 21 prerender_manager_(NULL, NULL) { |
22 } | 22 } |
23 | 23 |
24 PrerenderManager* prerender_manager() { return &prerender_manager_; } | 24 PrerenderManager* prerender_manager() { return &prerender_manager_; } |
25 | 25 |
26 MessageLoop message_loop_; | 26 base::MessageLoop message_loop_; |
27 content::TestBrowserThread ui_thread_; | 27 content::TestBrowserThread ui_thread_; |
28 PrerenderManager prerender_manager_; | 28 PrerenderManager prerender_manager_; |
29 }; | 29 }; |
30 | 30 |
31 TEST_F(PrerenderManagerTest, IsWebContentsPrerenderedTest) { | 31 TEST_F(PrerenderManagerTest, IsWebContentsPrerenderedTest) { |
32 // The methods being tested should not dereference their WebContents, instead | 32 // The methods being tested should not dereference their WebContents, instead |
33 // they use it as a unique identifier. | 33 // they use it as a unique identifier. |
34 int not_a_webcontents = 0; | 34 int not_a_webcontents = 0; |
35 content::WebContents* web_contents = | 35 content::WebContents* web_contents = |
36 reinterpret_cast<content::WebContents*>(¬_a_webcontents); | 36 reinterpret_cast<content::WebContents*>(¬_a_webcontents); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 web_contents, NULL)); | 91 web_contents, NULL)); |
92 | 92 |
93 prerender_manager()->MarkWebContentsAsNotPrerendered(web_contents); | 93 prerender_manager()->MarkWebContentsAsNotPrerendered(web_contents); |
94 EXPECT_FALSE(prerender_manager()->WouldWebContentsBePrerendered( | 94 EXPECT_FALSE(prerender_manager()->WouldWebContentsBePrerendered( |
95 web_contents, NULL)); | 95 web_contents, NULL)); |
96 } | 96 } |
97 | 97 |
98 } // namespace | 98 } // namespace |
99 | 99 |
100 } // namespace prerender | 100 } // namespace prerender |
OLD | NEW |