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 "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/string_split.h" | 7 #include "base/string_split.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/threading/sequenced_worker_pool.h" | 9 #include "base/threading/sequenced_worker_pool.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/page_cycler/page_cycler.h" | 13 #include "chrome/browser/page_cycler/page_cycler.h" |
| 14 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_list.h" | 15 #include "chrome/browser/ui/browser_list.h" |
15 #include "chrome/browser/ui/browser_tabstrip.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
16 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
17 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
18 #include "chrome/test/base/browser_with_test_window_test.h" | 19 #include "chrome/test/base/browser_with_test_window_test.h" |
19 #include "chrome/test/base/testing_pref_service.h" | 20 #include "chrome/test/base/testing_pref_service.h" |
20 #include "content/public/browser/render_view_host.h" | 21 #include "content/public/browser/render_view_host.h" |
21 #include "content/public/test/test_browser_thread.h" | 22 #include "content/public/test/test_browser_thread.h" |
22 #include "net/base/net_errors.h" | 23 #include "net/base/net_errors.h" |
23 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
25 | 26 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 107 |
107 virtual ~PageCyclerTest() { | 108 virtual ~PageCyclerTest() { |
108 } | 109 } |
109 | 110 |
110 virtual void SetUp() OVERRIDE { | 111 virtual void SetUp() OVERRIDE { |
111 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); | 112 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); |
112 test_data_dir_ = test_data_dir_.AppendASCII("page_cycler"); | 113 test_data_dir_ = test_data_dir_.AppendASCII("page_cycler"); |
113 | 114 |
114 BrowserWithTestWindowTest::SetUp(); | 115 BrowserWithTestWindowTest::SetUp(); |
115 AddTab(browser(), kAboutURL); | 116 AddTab(browser(), kAboutURL); |
116 ASSERT_FALSE(chrome::GetActiveWebContents(browser()) == NULL); | 117 ASSERT_FALSE(browser()->tab_strip_model()->GetActiveWebContents() == NULL); |
117 } | 118 } |
118 | 119 |
119 void InitFilePaths(const FilePath& temp_path) { | 120 void InitFilePaths(const FilePath& temp_path) { |
120 errors_file_ = temp_path.AppendASCII("errors_file"); | 121 errors_file_ = temp_path.AppendASCII("errors_file"); |
121 stats_file_ = temp_path.AppendASCII("stats_file"); | 122 stats_file_ = temp_path.AppendASCII("stats_file"); |
122 | 123 |
123 CHECK(!file_util::PathExists(errors_file_)); | 124 CHECK(!file_util::PathExists(errors_file_)); |
124 CHECK(!file_util::PathExists(stats_file_)); | 125 CHECK(!file_util::PathExists(stats_file_)); |
125 } | 126 } |
126 | 127 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 .WillRepeatedly(Invoke(page_cycler(), | 345 .WillRepeatedly(Invoke(page_cycler(), |
345 &MockPageCycler::PageCyclerDidFinishLoad)); | 346 &MockPageCycler::PageCyclerDidFinishLoad)); |
346 | 347 |
347 for (int i = 0; i < kNumLoads; ++i) | 348 for (int i = 0; i < kNumLoads; ++i) |
348 FinishLoad(); | 349 FinishLoad(); |
349 | 350 |
350 PumpLoop(); | 351 PumpLoop(); |
351 EXPECT_FALSE(PathExists(errors_file())); | 352 EXPECT_FALSE(PathExists(errors_file())); |
352 ASSERT_TRUE(PathExists(stats_file())); | 353 ASSERT_TRUE(PathExists(stats_file())); |
353 } | 354 } |
OLD | NEW |