Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: content/browser/tab_contents/tab_contents_delegate_unittest.cc

Issue 7465041: GTTF: Use a fresh TestingBrowserProcess for each test, part #4 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/tab_contents/navigation_entry_unittest.cc ('k') | content/common/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/test/base/testing_profile.h" 8 #include "chrome/test/base/testing_profile.h"
9 #include "chrome/test/testing_browser_process.h"
9 #include "content/browser/tab_contents/tab_contents.h" 10 #include "content/browser/tab_contents/tab_contents.h"
10 #include "content/browser/tab_contents/tab_contents_delegate.h" 11 #include "content/browser/tab_contents/tab_contents_delegate.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 13
13 namespace { 14 namespace {
14 15
15 class MockTabContentsDelegate : public TabContentsDelegate { 16 class MockTabContentsDelegate : public TabContentsDelegate {
16 public: 17 public:
17 virtual ~MockTabContentsDelegate() {} 18 virtual ~MockTabContentsDelegate() {}
18 19
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 55
55 virtual void CloseContents(TabContents* source) {} 56 virtual void CloseContents(TabContents* source) {}
56 57
57 virtual void MoveContents(TabContents* source, const gfx::Rect& pos) {} 58 virtual void MoveContents(TabContents* source, const gfx::Rect& pos) {}
58 59
59 virtual void UpdateTargetURL(TabContents* source, const GURL& url) {} 60 virtual void UpdateTargetURL(TabContents* source, const GURL& url) {}
60 }; 61 };
61 62
62 TEST(TabContentsDelegateTest, UnregisterInDestructor) { 63 TEST(TabContentsDelegateTest, UnregisterInDestructor) {
63 MessageLoop loop(MessageLoop::TYPE_UI); 64 MessageLoop loop(MessageLoop::TYPE_UI);
65 ScopedTestingBrowserProcess browser_process;
64 scoped_ptr<MockTabContentsDelegate> delegate(new MockTabContentsDelegate()); 66 scoped_ptr<MockTabContentsDelegate> delegate(new MockTabContentsDelegate());
65 scoped_ptr<Profile> profile(new TestingProfile()); 67 scoped_ptr<Profile> profile(new TestingProfile());
66 scoped_ptr<TabContents> contents_a( 68 scoped_ptr<TabContents> contents_a(
67 new TabContents(profile.get(), NULL, 0, NULL, NULL)); 69 new TabContents(profile.get(), NULL, 0, NULL, NULL));
68 scoped_ptr<TabContents> contents_b( 70 scoped_ptr<TabContents> contents_b(
69 new TabContents(profile.get(), NULL, 0, NULL, NULL)); 71 new TabContents(profile.get(), NULL, 0, NULL, NULL));
70 EXPECT_TRUE(contents_a->delegate() == NULL); 72 EXPECT_TRUE(contents_a->delegate() == NULL);
71 EXPECT_TRUE(contents_b->delegate() == NULL); 73 EXPECT_TRUE(contents_b->delegate() == NULL);
72 74
73 // Setting a delegate should work correctly. 75 // Setting a delegate should work correctly.
(...skipping 25 matching lines...) Expand all
99 EXPECT_TRUE(contents_a->delegate() == NULL); 101 EXPECT_TRUE(contents_a->delegate() == NULL);
100 EXPECT_TRUE(contents_b->delegate() == NULL); 102 EXPECT_TRUE(contents_b->delegate() == NULL);
101 103
102 // Destroy the tab contents and run the message loop to prevent leaks. 104 // Destroy the tab contents and run the message loop to prevent leaks.
103 contents_a.reset(NULL); 105 contents_a.reset(NULL);
104 contents_b.reset(NULL); 106 contents_b.reset(NULL);
105 loop.RunAllPending(); 107 loop.RunAllPending();
106 } 108 }
107 109
108 } // namespace 110 } // namespace
OLDNEW
« no previous file with comments | « content/browser/tab_contents/navigation_entry_unittest.cc ('k') | content/common/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698