| 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/prefs/testing_pref_service.h" | 7 #include "base/prefs/testing_pref_service.h" |
| 8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "net/base/net_errors.h" | 23 #include "net/base/net_errors.h" |
| 24 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 26 |
| 27 using ::testing::_; | 27 using ::testing::_; |
| 28 using ::testing::Invoke; | 28 using ::testing::Invoke; |
| 29 using content::RenderViewHost; | 29 using content::RenderViewHost; |
| 30 using content::TestBrowserThread; | 30 using content::TestBrowserThread; |
| 31 using content::WebContentsObserver; | 31 using content::WebContentsObserver; |
| 32 using file_util::ContentsEqual; | 32 using file_util::ContentsEqual; |
| 33 using file_util::PathExists; | 33 using base::PathExists; |
| 34 | 34 |
| 35 namespace { | 35 namespace { |
| 36 const int kFrameID = 1; | 36 const int kFrameID = 1; |
| 37 const bool kIsMainFrame = true; | 37 const bool kIsMainFrame = true; |
| 38 const GURL kAboutURL = GURL(content::kAboutBlankURL); | 38 const GURL kAboutURL = GURL(content::kAboutBlankURL); |
| 39 } // namespace | 39 } // namespace |
| 40 | 40 |
| 41 class MockPageCycler : public PageCycler { | 41 class MockPageCycler : public PageCycler { |
| 42 public: | 42 public: |
| 43 MockPageCycler(Browser* browser, base::FilePath urls_file, | 43 MockPageCycler(Browser* browser, base::FilePath urls_file, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 BrowserWithTestWindowTest::SetUp(); | 116 BrowserWithTestWindowTest::SetUp(); |
| 117 AddTab(browser(), kAboutURL); | 117 AddTab(browser(), kAboutURL); |
| 118 ASSERT_FALSE(browser()->tab_strip_model()->GetActiveWebContents() == NULL); | 118 ASSERT_FALSE(browser()->tab_strip_model()->GetActiveWebContents() == NULL); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void InitFilePaths(const base::FilePath& temp_path) { | 121 void InitFilePaths(const base::FilePath& temp_path) { |
| 122 errors_file_ = temp_path.AppendASCII("errors_file"); | 122 errors_file_ = temp_path.AppendASCII("errors_file"); |
| 123 stats_file_ = temp_path.AppendASCII("stats_file"); | 123 stats_file_ = temp_path.AppendASCII("stats_file"); |
| 124 | 124 |
| 125 CHECK(!file_util::PathExists(errors_file_)); | 125 CHECK(!base::PathExists(errors_file_)); |
| 126 CHECK(!file_util::PathExists(stats_file_)); | 126 CHECK(!base::PathExists(stats_file_)); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void FailProvisionalLoad(int error_code, string16& error_description) { | 129 void FailProvisionalLoad(int error_code, string16& error_description) { |
| 130 FOR_EACH_OBSERVER( | 130 FOR_EACH_OBSERVER( |
| 131 WebContentsObserver, | 131 WebContentsObserver, |
| 132 observers_, | 132 observers_, |
| 133 DidFailProvisionalLoad(kFrameID, kIsMainFrame, kAboutURL, error_code, | 133 DidFailProvisionalLoad(kFrameID, kIsMainFrame, kAboutURL, error_code, |
| 134 error_description, NULL)); | 134 error_description, NULL)); |
| 135 PumpLoop(); | 135 PumpLoop(); |
| 136 } | 136 } |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 .WillRepeatedly(Invoke(page_cycler(), | 346 .WillRepeatedly(Invoke(page_cycler(), |
| 347 &MockPageCycler::PageCyclerDidFinishLoad)); | 347 &MockPageCycler::PageCyclerDidFinishLoad)); |
| 348 | 348 |
| 349 for (int i = 0; i < kNumLoads; ++i) | 349 for (int i = 0; i < kNumLoads; ++i) |
| 350 FinishLoad(); | 350 FinishLoad(); |
| 351 | 351 |
| 352 PumpLoop(); | 352 PumpLoop(); |
| 353 EXPECT_FALSE(PathExists(errors_file())); | 353 EXPECT_FALSE(PathExists(errors_file())); |
| 354 ASSERT_TRUE(PathExists(stats_file())); | 354 ASSERT_TRUE(PathExists(stats_file())); |
| 355 } | 355 } |
| OLD | NEW |