| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <map> | 5 #include <map> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "app/system_monitor.h" | |
| 9 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 11 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 12 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 13 #include "base/stl_util-inl.h" | 12 #include "base/stl_util-inl.h" |
| 14 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
| 15 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 16 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 17 #include "chrome/browser/defaults.h" | 16 #include "chrome/browser/defaults.h" |
| 18 #include "chrome/browser/dom_ui/new_tab_ui.h" | 17 #include "chrome/browser/dom_ui/new_tab_ui.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 29 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 30 #include "chrome/common/extensions/extension.h" | 29 #include "chrome/common/extensions/extension.h" |
| 31 #include "chrome/common/notification_details.h" | 30 #include "chrome/common/notification_details.h" |
| 32 #include "chrome/common/notification_observer_mock.h" | 31 #include "chrome/common/notification_observer_mock.h" |
| 33 #include "chrome/common/notification_registrar.h" | 32 #include "chrome/common/notification_registrar.h" |
| 34 #include "chrome/common/notification_source.h" | 33 #include "chrome/common/notification_source.h" |
| 35 #include "chrome/common/property_bag.h" | 34 #include "chrome/common/property_bag.h" |
| 36 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
| 37 #include "chrome/test/testing_profile.h" | 36 #include "chrome/test/testing_profile.h" |
| 38 #include "testing/gtest/include/gtest/gtest.h" | 37 #include "testing/gtest/include/gtest/gtest.h" |
| 38 #include "ui/base/system_monitor/system_monitor.h" |
| 39 | 39 |
| 40 using testing::_; | 40 using testing::_; |
| 41 | 41 |
| 42 namespace { | 42 namespace { |
| 43 | 43 |
| 44 // Class used to delete a TabContents when another TabContents is destroyed. | 44 // Class used to delete a TabContents when another TabContents is destroyed. |
| 45 class DeleteTabContentsOnDestroyedObserver : public NotificationObserver { | 45 class DeleteTabContentsOnDestroyedObserver : public NotificationObserver { |
| 46 public: | 46 public: |
| 47 DeleteTabContentsOnDestroyedObserver(TabContentsWrapper* source, | 47 DeleteTabContentsOnDestroyedObserver(TabContentsWrapper* source, |
| 48 TabContentsWrapper* tab_to_delete) | 48 TabContentsWrapper* tab_to_delete) |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 private: | 223 private: |
| 224 PropertyAccessor<int>* GetIDAccessor() { | 224 PropertyAccessor<int>* GetIDAccessor() { |
| 225 static PropertyAccessor<int> accessor; | 225 static PropertyAccessor<int> accessor; |
| 226 return &accessor; | 226 return &accessor; |
| 227 } | 227 } |
| 228 | 228 |
| 229 std::wstring test_dir_; | 229 std::wstring test_dir_; |
| 230 std::wstring profile_path_; | 230 std::wstring profile_path_; |
| 231 std::map<TabContents*, int> foo_; | 231 std::map<TabContents*, int> foo_; |
| 232 | 232 |
| 233 // ProfileManager requires a SystemMonitor. | 233 // ProfileManager requires a ui::SystemMonitor. |
| 234 SystemMonitor system_monitor; | 234 ui::SystemMonitor system_monitor; |
| 235 | 235 |
| 236 ProfileManager pm_; | 236 ProfileManager pm_; |
| 237 }; | 237 }; |
| 238 | 238 |
| 239 class MockTabStripModelObserver : public TabStripModelObserver { | 239 class MockTabStripModelObserver : public TabStripModelObserver { |
| 240 public: | 240 public: |
| 241 MockTabStripModelObserver() : empty_(true) {} | 241 MockTabStripModelObserver() : empty_(true) {} |
| 242 ~MockTabStripModelObserver() { | 242 ~MockTabStripModelObserver() { |
| 243 STLDeleteContainerPointers(states_.begin(), states_.end()); | 243 STLDeleteContainerPointers(states_.begin(), states_.end()); |
| 244 } | 244 } |
| (...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1891 TabStripModel strip(&delegate, profile()); | 1891 TabStripModel strip(&delegate, profile()); |
| 1892 TabContentsWrapper* contents1 = CreateTabContents(); | 1892 TabContentsWrapper* contents1 = CreateTabContents(); |
| 1893 TabContentsWrapper* contents2 = CreateTabContents(); | 1893 TabContentsWrapper* contents2 = CreateTabContents(); |
| 1894 strip.AppendTabContents(contents1, true); | 1894 strip.AppendTabContents(contents1, true); |
| 1895 strip.AppendTabContents(contents2, true); | 1895 strip.AppendTabContents(contents2, true); |
| 1896 // DeleteTabContentsOnDestroyedObserver deletes contents1 when contents2 sends | 1896 // DeleteTabContentsOnDestroyedObserver deletes contents1 when contents2 sends |
| 1897 // out notification that it is being destroyed. | 1897 // out notification that it is being destroyed. |
| 1898 DeleteTabContentsOnDestroyedObserver observer(contents2, contents1); | 1898 DeleteTabContentsOnDestroyedObserver observer(contents2, contents1); |
| 1899 strip.CloseAllTabs(); | 1899 strip.CloseAllTabs(); |
| 1900 } | 1900 } |
| OLD | NEW |