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/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 using ::testing::ReturnRefOfCopy; | 34 using ::testing::ReturnRefOfCopy; |
35 using ::testing::SetArgPointee; | 35 using ::testing::SetArgPointee; |
36 using ::testing::WithArg; | 36 using ::testing::WithArg; |
37 using ::testing::_; | 37 using ::testing::_; |
38 using content::DownloadItem; | 38 using content::DownloadItem; |
39 | 39 |
40 namespace { | 40 namespace { |
41 | 41 |
42 class MockWebContentsDelegate : public content::WebContentsDelegate { | 42 class MockWebContentsDelegate : public content::WebContentsDelegate { |
43 public: | 43 public: |
44 virtual ~MockWebContentsDelegate() {} | 44 ~MockWebContentsDelegate() override {} |
45 }; | 45 }; |
46 | 46 |
47 // Google Mock action that posts a task to the current message loop that invokes | 47 // Google Mock action that posts a task to the current message loop that invokes |
48 // the first argument of the mocked method as a callback. Said argument must be | 48 // the first argument of the mocked method as a callback. Said argument must be |
49 // a base::Callback<void(ParamType)>. |result| must be of |ParamType| and is | 49 // a base::Callback<void(ParamType)>. |result| must be of |ParamType| and is |
50 // bound as that parameter. | 50 // bound as that parameter. |
51 // Example: | 51 // Example: |
52 // class FooClass { | 52 // class FooClass { |
53 // public: | 53 // public: |
54 // virtual void Foo(base::Callback<void(bool)> callback); | 54 // virtual void Foo(base::Callback<void(bool)> callback); |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 CreateActiveDownloadItem(1)); | 392 CreateActiveDownloadItem(1)); |
393 EXPECT_CALL(*download_item, GetTargetFilePath()) | 393 EXPECT_CALL(*download_item, GetTargetFilePath()) |
394 .WillRepeatedly(ReturnRef(existing_path)); | 394 .WillRepeatedly(ReturnRef(existing_path)); |
395 EXPECT_TRUE(CheckForFileExistence(download_item.get())); | 395 EXPECT_TRUE(CheckForFileExistence(download_item.get())); |
396 | 396 |
397 download_item.reset(CreateActiveDownloadItem(1)); | 397 download_item.reset(CreateActiveDownloadItem(1)); |
398 EXPECT_CALL(*download_item, GetTargetFilePath()) | 398 EXPECT_CALL(*download_item, GetTargetFilePath()) |
399 .WillRepeatedly(ReturnRef(non_existent_path)); | 399 .WillRepeatedly(ReturnRef(non_existent_path)); |
400 EXPECT_FALSE(CheckForFileExistence(download_item.get())); | 400 EXPECT_FALSE(CheckForFileExistence(download_item.get())); |
401 } | 401 } |
OLD | NEW |