OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "content/browser/tab_contents/tab_contents.h" | 8 #include "content/browser/tab_contents/tab_contents.h" |
9 #include "content/browser/tab_contents/tab_contents_delegate.h" | 9 #include "content/browser/tab_contents/tab_contents_delegate.h" |
10 #include "content/test/test_browser_context.h" | 10 #include "content/test/test_browser_context.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 class MockTabContentsDelegate : public TabContentsDelegate { | 15 class MockTabContentsDelegate : public TabContentsDelegate { |
16 public: | 16 public: |
17 virtual ~MockTabContentsDelegate() {} | 17 virtual ~MockTabContentsDelegate() {} |
18 | 18 |
19 // TODO(adriansc): Remove this method when refactoring changed all call sites. | |
20 virtual TabContents* OpenURLFromTab( | |
21 TabContents* source, | |
22 const GURL& url, | |
23 const GURL& referrer, | |
24 WindowOpenDisposition disposition, | |
25 content::PageTransition transition) OVERRIDE { | |
26 return NULL; | |
27 } | |
28 | |
29 virtual TabContents* OpenURLFromTab(TabContents* source, | 19 virtual TabContents* OpenURLFromTab(TabContents* source, |
30 const OpenURLParams& params) OVERRIDE { | 20 const OpenURLParams& params) OVERRIDE { |
31 return NULL; | 21 return NULL; |
32 } | 22 } |
33 | 23 |
34 virtual void NavigationStateChanged(const TabContents* source, | 24 virtual void NavigationStateChanged(const TabContents* source, |
35 unsigned changed_flags) OVERRIDE {} | 25 unsigned changed_flags) OVERRIDE {} |
36 | 26 |
37 virtual void AddNavigationHeaders( | 27 virtual void AddNavigationHeaders( |
38 const GURL& url, std::string* headers) OVERRIDE { | 28 const GURL& url, std::string* headers) OVERRIDE { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 EXPECT_TRUE(contents_a->delegate() == NULL); | 94 EXPECT_TRUE(contents_a->delegate() == NULL); |
105 EXPECT_TRUE(contents_b->delegate() == NULL); | 95 EXPECT_TRUE(contents_b->delegate() == NULL); |
106 | 96 |
107 // Destroy the tab contents and run the message loop to prevent leaks. | 97 // Destroy the tab contents and run the message loop to prevent leaks. |
108 contents_a.reset(NULL); | 98 contents_a.reset(NULL); |
109 contents_b.reset(NULL); | 99 contents_b.reset(NULL); |
110 loop.RunAllPending(); | 100 loop.RunAllPending(); |
111 } | 101 } |
112 | 102 |
113 } // namespace | 103 } // namespace |
OLD | NEW |