| 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 "chrome/browser/android/tab_android.h" | 5 #include "chrome/browser/android/tab_android.h" |
| 6 #include "chrome/browser/chrome_notification_types.h" | 6 #include "chrome/browser/chrome_notification_types.h" |
| 7 #include "chrome/browser/ui/android/tab_model/tab_model.h" | 7 #include "chrome/browser/ui/android/tab_model/tab_model.h" |
| 8 #include "chrome/test/base/testing_profile.h" | 8 #include "chrome/test/base/testing_profile.h" |
| 9 #include "content/public/browser/notification_service.h" | 9 #include "content/public/browser/notification_service.h" |
| 10 #include "content/public/browser/notification_source.h" | 10 #include "content/public/browser/notification_source.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 TabModelAndroidProfileMock() {} | 22 TabModelAndroidProfileMock() {} |
| 23 virtual ~TabModelAndroidProfileMock() {} | 23 virtual ~TabModelAndroidProfileMock() {} |
| 24 | 24 |
| 25 MOCK_METHOD0(GetOffTheRecordProfile, Profile*()); | 25 MOCK_METHOD0(GetOffTheRecordProfile, Profile*()); |
| 26 MOCK_METHOD0(HasOffTheRecordProfile, bool()); | 26 MOCK_METHOD0(HasOffTheRecordProfile, bool()); |
| 27 }; | 27 }; |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 class TestTabModel : public TabModel { | 30 class TestTabModel : public TabModel { |
| 31 public: | 31 public: |
| 32 explicit TestTabModel(Profile* profile) | 32 explicit TestTabModel(Profile* profile) : TabModel(profile, false) {} |
| 33 : TabModel(profile) {} | |
| 34 | 33 |
| 35 int GetTabCount() const override { return 0; } | 34 int GetTabCount() const override { return 0; } |
| 36 int GetActiveIndex() const override { return 0; } | 35 int GetActiveIndex() const override { return 0; } |
| 37 content::WebContents* GetWebContentsAt(int index) const override { | 36 content::WebContents* GetWebContentsAt(int index) const override { |
| 38 return NULL; | 37 return NULL; |
| 39 } | 38 } |
| 40 void CreateTab(TabAndroid* parent, | 39 void CreateTab(TabAndroid* parent, |
| 41 content::WebContents* web_contents, | 40 content::WebContents* web_contents, |
| 42 int parent_tab_id) override {} | 41 int parent_tab_id) override {} |
| 43 content::WebContents* CreateNewTabForDevTools(const GURL& url) override { | 42 content::WebContents* CreateNewTabForDevTools(const GURL& url) override { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 EXPECT_EQ(&testing_profile, tab_model.GetProfile()); | 78 EXPECT_EQ(&testing_profile, tab_model.GetProfile()); |
| 80 EXPECT_TRUE(tab_model.IsOffTheRecord()); | 79 EXPECT_TRUE(tab_model.IsOffTheRecord()); |
| 81 | 80 |
| 82 // Notify profile is being destroyed and verify pointer is cleared. | 81 // Notify profile is being destroyed and verify pointer is cleared. |
| 83 content::NotificationService::current()->Notify( | 82 content::NotificationService::current()->Notify( |
| 84 chrome::NOTIFICATION_PROFILE_DESTROYED, | 83 chrome::NOTIFICATION_PROFILE_DESTROYED, |
| 85 content::Source<Profile>(&testing_profile), | 84 content::Source<Profile>(&testing_profile), |
| 86 content::NotificationService::NoDetails()); | 85 content::NotificationService::NoDetails()); |
| 87 EXPECT_EQ(NULL, tab_model.GetProfile()); | 86 EXPECT_EQ(NULL, tab_model.GetProfile()); |
| 88 } | 87 } |
| OLD | NEW |