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

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: should work Created 9 years, 5 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
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/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "chrome/test/testing_browser_process.h"
7 #include "chrome/test/testing_profile.h" 8 #include "chrome/test/testing_profile.h"
8 #include "content/browser/tab_contents/tab_contents.h" 9 #include "content/browser/tab_contents/tab_contents.h"
9 #include "content/browser/tab_contents/tab_contents_delegate.h" 10 #include "content/browser/tab_contents/tab_contents_delegate.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 12
12 namespace { 13 namespace {
13 14
14 class MockTabContentsDelegate : public TabContentsDelegate { 15 class MockTabContentsDelegate : public TabContentsDelegate {
15 public: 16 public:
16 virtual ~MockTabContentsDelegate() {} 17 virtual ~MockTabContentsDelegate() {}
(...skipping 28 matching lines...) Expand all
45 virtual void LoadProgressChanged(double progress) {} 46 virtual void LoadProgressChanged(double progress) {}
46 47
47 virtual void CloseContents(TabContents* source) {} 48 virtual void CloseContents(TabContents* source) {}
48 49
49 virtual void MoveContents(TabContents* source, const gfx::Rect& pos) {} 50 virtual void MoveContents(TabContents* source, const gfx::Rect& pos) {}
50 51
51 virtual void UpdateTargetURL(TabContents* source, const GURL& url) {} 52 virtual void UpdateTargetURL(TabContents* source, const GURL& url) {}
52 }; 53 };
53 54
54 TEST(TabContentsDelegateTest, UnregisterInDestructor) { 55 TEST(TabContentsDelegateTest, UnregisterInDestructor) {
56 ScopedTestingBrowserProcess browser_process;
55 MessageLoop loop(MessageLoop::TYPE_UI); 57 MessageLoop loop(MessageLoop::TYPE_UI);
56 scoped_ptr<MockTabContentsDelegate> delegate(new MockTabContentsDelegate()); 58 scoped_ptr<MockTabContentsDelegate> delegate(new MockTabContentsDelegate());
57 scoped_ptr<Profile> profile(new TestingProfile()); 59 scoped_ptr<Profile> profile(new TestingProfile());
58 scoped_ptr<TabContents> contents_a( 60 scoped_ptr<TabContents> contents_a(
59 new TabContents(profile.get(), NULL, 0, NULL, NULL)); 61 new TabContents(profile.get(), NULL, 0, NULL, NULL));
60 scoped_ptr<TabContents> contents_b( 62 scoped_ptr<TabContents> contents_b(
61 new TabContents(profile.get(), NULL, 0, NULL, NULL)); 63 new TabContents(profile.get(), NULL, 0, NULL, NULL));
62 EXPECT_TRUE(contents_a->delegate() == NULL); 64 EXPECT_TRUE(contents_a->delegate() == NULL);
63 EXPECT_TRUE(contents_b->delegate() == NULL); 65 EXPECT_TRUE(contents_b->delegate() == NULL);
64 66
(...skipping 26 matching lines...) Expand all
91 EXPECT_TRUE(contents_a->delegate() == NULL); 93 EXPECT_TRUE(contents_a->delegate() == NULL);
92 EXPECT_TRUE(contents_b->delegate() == NULL); 94 EXPECT_TRUE(contents_b->delegate() == NULL);
93 95
94 // Destroy the tab contents and run the message loop to prevent leaks. 96 // Destroy the tab contents and run the message loop to prevent leaks.
95 contents_a.reset(NULL); 97 contents_a.reset(NULL);
96 contents_b.reset(NULL); 98 contents_b.reset(NULL);
97 loop.RunAllPending(); 99 loop.RunAllPending();
98 } 100 }
99 101
100 } // namespace 102 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698