| OLD | NEW |
| 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 <map> | 5 #include <map> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/stl_util-inl.h" | 12 #include "base/stl_util-inl.h" |
| 13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
| 14 #include "base/string_split.h" | 14 #include "base/string_split.h" |
| 15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "base/system_monitor/system_monitor.h" | |
| 17 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 18 #include "chrome/browser/defaults.h" | 17 #include "chrome/browser/defaults.h" |
| 19 #include "chrome/browser/extensions/extension_tab_helper.h" | 18 #include "chrome/browser/extensions/extension_tab_helper.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
| 22 #include "chrome/browser/tabs/tab_strip_model.h" | 21 #include "chrome/browser/tabs/tab_strip_model.h" |
| 23 #include "chrome/browser/tabs/tab_strip_model_delegate.h" | 22 #include "chrome/browser/tabs/tab_strip_model_delegate.h" |
| 24 #include "chrome/browser/tabs/tab_strip_model_order_controller.h" | 23 #include "chrome/browser/tabs/tab_strip_model_order_controller.h" |
| 25 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
| 26 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 25 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 27 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 26 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 28 #include "chrome/common/extensions/extension.h" | 27 #include "chrome/common/extensions/extension.h" |
| 29 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" |
| 30 #include "chrome/test/testing_profile.h" | 29 #include "chrome/test/testing_profile.h" |
| 31 #include "content/browser/renderer_host/test_render_view_host.h" | 30 #include "content/browser/renderer_host/test_render_view_host.h" |
| 32 #include "content/browser/tab_contents/navigation_controller.h" | 31 #include "content/browser/tab_contents/navigation_controller.h" |
| 33 #include "content/browser/tab_contents/navigation_entry.h" | 32 #include "content/browser/tab_contents/navigation_entry.h" |
| 34 #include "content/browser/tab_contents/tab_contents.h" | 33 #include "content/browser/tab_contents/tab_contents.h" |
| 35 #include "content/common/notification_details.h" | 34 #include "content/common/notification_details.h" |
| 36 #include "content/common/notification_observer_mock.h" | 35 #include "content/common/notification_observer_mock.h" |
| 37 #include "content/common/notification_registrar.h" | 36 #include "content/common/notification_registrar.h" |
| 38 #include "content/common/notification_source.h" | 37 #include "content/common/notification_source.h" |
| 39 #include "content/common/property_bag.h" | 38 #include "content/common/property_bag.h" |
| 40 #include "testing/gtest/include/gtest/gtest.h" | 39 #include "testing/gtest/include/gtest/gtest.h" |
| 40 #include "ui/base/system_monitor/system_monitor.h" |
| 41 | 41 |
| 42 using testing::_; | 42 using testing::_; |
| 43 | 43 |
| 44 namespace { | 44 namespace { |
| 45 | 45 |
| 46 // Class used to delete a TabContents when another TabContents is destroyed. | 46 // Class used to delete a TabContents when another TabContents is destroyed. |
| 47 class DeleteTabContentsOnDestroyedObserver : public NotificationObserver { | 47 class DeleteTabContentsOnDestroyedObserver : public NotificationObserver { |
| 48 public: | 48 public: |
| 49 DeleteTabContentsOnDestroyedObserver(TabContentsWrapper* source, | 49 DeleteTabContentsOnDestroyedObserver(TabContentsWrapper* source, |
| 50 TabContentsWrapper* tab_to_delete) | 50 TabContentsWrapper* tab_to_delete) |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 private: | 255 private: |
| 256 PropertyAccessor<int>* GetIDAccessor() { | 256 PropertyAccessor<int>* GetIDAccessor() { |
| 257 static PropertyAccessor<int> accessor; | 257 static PropertyAccessor<int> accessor; |
| 258 return &accessor; | 258 return &accessor; |
| 259 } | 259 } |
| 260 | 260 |
| 261 std::wstring test_dir_; | 261 std::wstring test_dir_; |
| 262 std::wstring profile_path_; | 262 std::wstring profile_path_; |
| 263 std::map<TabContents*, int> foo_; | 263 std::map<TabContents*, int> foo_; |
| 264 | 264 |
| 265 // ProfileManager requires a base::SystemMonitor. | 265 // ProfileManager requires a ui::SystemMonitor. |
| 266 base::SystemMonitor system_monitor; | 266 ui::SystemMonitor system_monitor; |
| 267 | 267 |
| 268 ProfileManager pm_; | 268 ProfileManager pm_; |
| 269 }; | 269 }; |
| 270 | 270 |
| 271 class MockTabStripModelObserver : public TabStripModelObserver { | 271 class MockTabStripModelObserver : public TabStripModelObserver { |
| 272 public: | 272 public: |
| 273 MockTabStripModelObserver() : empty_(true) {} | 273 MockTabStripModelObserver() : empty_(true) {} |
| 274 ~MockTabStripModelObserver() { | 274 ~MockTabStripModelObserver() { |
| 275 STLDeleteContainerPointers(states_.begin(), states_.end()); | 275 STLDeleteContainerPointers(states_.begin(), states_.end()); |
| 276 } | 276 } |
| (...skipping 1924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2201 strip.ActivateTabAt(1, true); | 2201 strip.ActivateTabAt(1, true); |
| 2202 ASSERT_EQ(1, observer.GetStateCount()); | 2202 ASSERT_EQ(1, observer.GetStateCount()); |
| 2203 MockTabStripModelObserver::State s( | 2203 MockTabStripModelObserver::State s( |
| 2204 contents2, 1, MockTabStripModelObserver::SELECT); | 2204 contents2, 1, MockTabStripModelObserver::SELECT); |
| 2205 s.src_contents = contents2; | 2205 s.src_contents = contents2; |
| 2206 s.user_gesture = true; | 2206 s.user_gesture = true; |
| 2207 EXPECT_TRUE(observer.StateEquals(0, s)); | 2207 EXPECT_TRUE(observer.StateEquals(0, s)); |
| 2208 strip.RemoveObserver(&observer); | 2208 strip.RemoveObserver(&observer); |
| 2209 strip.CloseAllTabs(); | 2209 strip.CloseAllTabs(); |
| 2210 } | 2210 } |
| OLD | NEW |