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 "chrome/browser/tabs/tab_strip_model.h" | 5 #include "chrome/browser/tabs/tab_strip_model.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/property_bag.h" |
14 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
15 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
16 #include "base/string_split.h" | 17 #include "base/string_split.h" |
17 #include "base/string_util.h" | 18 #include "base/string_util.h" |
18 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
19 #include "chrome/browser/defaults.h" | 20 #include "chrome/browser/defaults.h" |
20 #include "chrome/browser/extensions/extension_tab_helper.h" | 21 #include "chrome/browser/extensions/extension_tab_helper.h" |
21 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/tabs/tab_strip_model_delegate.h" | 23 #include "chrome/browser/tabs/tab_strip_model_delegate.h" |
23 #include "chrome/browser/tabs/tab_strip_model_order_controller.h" | 24 #include "chrome/browser/tabs/tab_strip_model_order_controller.h" |
24 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
25 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 26 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
26 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 27 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
27 #include "chrome/common/extensions/extension.h" | 28 #include "chrome/common/extensions/extension.h" |
28 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
29 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 30 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
30 #include "chrome/test/base/testing_profile.h" | 31 #include "chrome/test/base/testing_profile.h" |
31 #include "content/browser/tab_contents/navigation_controller.h" | 32 #include "content/browser/tab_contents/navigation_controller.h" |
32 #include "content/browser/tab_contents/navigation_entry.h" | 33 #include "content/browser/tab_contents/navigation_entry.h" |
33 #include "content/browser/tab_contents/tab_contents.h" | 34 #include "content/browser/tab_contents/tab_contents.h" |
34 #include "content/common/property_bag.h" | |
35 #include "content/public/browser/notification_details.h" | 35 #include "content/public/browser/notification_details.h" |
36 #include "content/public/browser/notification_registrar.h" | 36 #include "content/public/browser/notification_registrar.h" |
37 #include "content/public/browser/notification_source.h" | 37 #include "content/public/browser/notification_source.h" |
38 #include "content/public/browser/notification_types.h" | 38 #include "content/public/browser/notification_types.h" |
39 #include "content/test/notification_observer_mock.h" | 39 #include "content/test/notification_observer_mock.h" |
40 #include "content/test/test_browser_thread.h" | 40 #include "content/test/test_browser_thread.h" |
41 #include "testing/gtest/include/gtest/gtest.h" | 41 #include "testing/gtest/include/gtest/gtest.h" |
42 | 42 |
43 using content::BrowserThread; | 43 using content::BrowserThread; |
44 using testing::_; | 44 using testing::_; |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 for (size_t i = 0; i < selection.size(); ++i) { | 249 for (size_t i = 0; i < selection.size(); ++i) { |
250 int value; | 250 int value; |
251 ASSERT_TRUE(base::StringToInt(selection[i], &value)); | 251 ASSERT_TRUE(base::StringToInt(selection[i], &value)); |
252 selection_model.AddIndexToSelection(value); | 252 selection_model.AddIndexToSelection(value); |
253 } | 253 } |
254 selection_model.set_active(selection_model.selected_indices()[0]); | 254 selection_model.set_active(selection_model.selected_indices()[0]); |
255 model->SetSelectionFromModel(selection_model); | 255 model->SetSelectionFromModel(selection_model); |
256 } | 256 } |
257 | 257 |
258 private: | 258 private: |
259 PropertyAccessor<int>* GetIDAccessor() { | 259 base::PropertyAccessor<int>* GetIDAccessor() { |
260 static PropertyAccessor<int> accessor; | 260 static base::PropertyAccessor<int> accessor; |
261 return &accessor; | 261 return &accessor; |
262 } | 262 } |
263 | 263 |
264 content::TestBrowserThread browser_thread_; | 264 content::TestBrowserThread browser_thread_; |
265 | 265 |
266 std::wstring test_dir_; | 266 std::wstring test_dir_; |
267 std::wstring profile_path_; | 267 std::wstring profile_path_; |
268 std::map<TabContents*, int> foo_; | 268 std::map<TabContents*, int> foo_; |
269 }; | 269 }; |
270 | 270 |
(...skipping 2104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2375 ASSERT_EQ(1, observer.GetStateCount()); | 2375 ASSERT_EQ(1, observer.GetStateCount()); |
2376 MockTabStripModelObserver::State s( | 2376 MockTabStripModelObserver::State s( |
2377 contents2, 1, MockTabStripModelObserver::SELECT); | 2377 contents2, 1, MockTabStripModelObserver::SELECT); |
2378 s.src_contents = contents2; | 2378 s.src_contents = contents2; |
2379 s.src_index = 1; | 2379 s.src_index = 1; |
2380 s.user_gesture = false; | 2380 s.user_gesture = false; |
2381 EXPECT_TRUE(observer.StateEquals(0, s)); | 2381 EXPECT_TRUE(observer.StateEquals(0, s)); |
2382 strip.RemoveObserver(&observer); | 2382 strip.RemoveObserver(&observer); |
2383 strip.CloseAllTabs(); | 2383 strip.CloseAllTabs(); |
2384 } | 2384 } |
OLD | NEW |