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

Side by Side Diff: chrome/browser/ui/android/tab_model/tab_model_unittest.cc

Issue 14876034: Enable Clang warnings for implementation files on all platforms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: gypi style tweak Created 7 years, 7 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) 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/browser/ui/android/tab_model/tab_model.h" 5 #include "chrome/browser/ui/android/tab_model/tab_model.h"
6 #include "chrome/common/chrome_notification_types.h" 6 #include "chrome/common/chrome_notification_types.h"
7 #include "chrome/test/base/testing_profile.h" 7 #include "chrome/test/base/testing_profile.h"
8 #include "content/public/browser/notification_service.h" 8 #include "content/public/browser/notification_service.h"
9 #include "content/public/browser/notification_source.h" 9 #include "content/public/browser/notification_source.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 10 matching lines...) Expand all
21 MOCK_METHOD0(GetOffTheRecordProfile, Profile*()); 21 MOCK_METHOD0(GetOffTheRecordProfile, Profile*());
22 MOCK_METHOD0(HasOffTheRecordProfile, bool()); 22 MOCK_METHOD0(HasOffTheRecordProfile, bool());
23 }; 23 };
24 } // namespace 24 } // namespace
25 25
26 class TestTabModel : public TabModel { 26 class TestTabModel : public TabModel {
27 public: 27 public:
28 explicit TestTabModel(Profile* profile) 28 explicit TestTabModel(Profile* profile)
29 : TabModel(profile) {} 29 : TabModel(profile) {}
30 30
31 int GetTabCount() const OVERRIDE { return 0; } 31 virtual int GetTabCount() const OVERRIDE { return 0; }
32 int GetActiveIndex() const OVERRIDE { return 0; } 32 virtual int GetActiveIndex() const OVERRIDE { return 0; }
33 content::WebContents* GetWebContentsAt(int index) const OVERRIDE { 33 virtual content::WebContents* GetWebContentsAt(int index) const OVERRIDE {
34 return NULL; 34 return NULL;
35 } 35 }
36 SessionID::id_type GetTabIdAt(int index) const OVERRIDE { return 0; } 36 virtual SessionID::id_type GetTabIdAt(int index) const OVERRIDE { return 0; }
37 void CreateTab(content::WebContents* web_contents) OVERRIDE {} 37 virtual void CreateTab(content::WebContents* web_contents) OVERRIDE {}
38 bool IsSessionRestoreInProgress() const OVERRIDE { return false; } 38 virtual bool IsSessionRestoreInProgress() const OVERRIDE { return false; }
39 void OpenClearBrowsingData() const OVERRIDE {} 39 virtual void OpenClearBrowsingData() const OVERRIDE {}
40 }; 40 };
41 41
42 TEST_F(TabModelTest, TestProfileHandling) { 42 TEST_F(TabModelTest, TestProfileHandling) {
43 // Construct TabModel with standard Profile. 43 // Construct TabModel with standard Profile.
44 TestingProfile testing_profile; 44 TestingProfile testing_profile;
45 TestTabModel tab_model(&testing_profile); 45 TestTabModel tab_model(&testing_profile);
46 46
47 // Verify TabModel has the correct profile and profile type. 47 // Verify TabModel has the correct profile and profile type.
48 EXPECT_EQ(&testing_profile, tab_model.GetProfile()); 48 EXPECT_EQ(&testing_profile, tab_model.GetProfile());
49 EXPECT_FALSE(tab_model.IsOffTheRecord()); 49 EXPECT_FALSE(tab_model.IsOffTheRecord());
(...skipping 19 matching lines...) Expand all
69 EXPECT_EQ(&testing_profile, tab_model.GetProfile()); 69 EXPECT_EQ(&testing_profile, tab_model.GetProfile());
70 EXPECT_TRUE(tab_model.IsOffTheRecord()); 70 EXPECT_TRUE(tab_model.IsOffTheRecord());
71 71
72 // Notify profile is being destroyed and verify pointer is cleared. 72 // Notify profile is being destroyed and verify pointer is cleared.
73 content::NotificationService::current()->Notify( 73 content::NotificationService::current()->Notify(
74 chrome::NOTIFICATION_PROFILE_DESTROYED, 74 chrome::NOTIFICATION_PROFILE_DESTROYED,
75 content::Source<Profile>(&testing_profile), 75 content::Source<Profile>(&testing_profile),
76 content::NotificationService::NoDetails()); 76 content::NotificationService::NoDetails());
77 EXPECT_EQ(NULL, tab_model.GetProfile()); 77 EXPECT_EQ(NULL, tab_model.GetProfile());
78 } 78 }
OLDNEW
« no previous file with comments | « chrome/browser/history/android/visit_sql_handler_unittest.cc ('k') | content/app/android/child_process_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698