| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/scoped_ptr.h" | 5 #include "base/scoped_ptr.h" |
| 6 #include "chrome/browser/instant/instant_loader.h" | 6 #include "chrome/browser/instant/instant_loader.h" |
| 7 #include "chrome/browser/instant/instant_loader_delegate.h" | 7 #include "chrome/browser/instant/instant_loader_delegate.h" |
| 8 #include "chrome/browser/instant/instant_loader_manager.h" | 8 #include "chrome/browser/instant/instant_loader_manager.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 class InstantLoaderDelegateImpl : public InstantLoaderDelegate { | 13 class InstantLoaderDelegateImpl : public InstantLoaderDelegate { |
| 14 public: | 14 public: |
| 15 InstantLoaderDelegateImpl() {} | 15 InstantLoaderDelegateImpl() {} |
| 16 | 16 |
| 17 virtual void ShowInstantLoader(InstantLoader* loader) {} | 17 virtual void ShowInstantLoader(InstantLoader* loader) OVERRIDE {} |
| 18 | 18 |
| 19 virtual void SetSuggestedTextFor(InstantLoader* loader, | 19 virtual void SetSuggestedTextFor(InstantLoader* loader, |
| 20 const string16& text) {} | 20 const string16& text, |
| 21 InstantCompleteBehavior behavior) OVERRIDE {} |
| 21 | 22 |
| 22 virtual gfx::Rect GetInstantBounds() { | 23 virtual gfx::Rect GetInstantBounds() OVERRIDE { |
| 23 return gfx::Rect(); | 24 return gfx::Rect(); |
| 24 } | 25 } |
| 25 | 26 |
| 26 virtual bool ShouldCommitInstantOnMouseUp() { | 27 virtual bool ShouldCommitInstantOnMouseUp() OVERRIDE { |
| 27 return false; | 28 return false; |
| 28 } | 29 } |
| 29 | 30 |
| 30 virtual void CommitInstantLoader(InstantLoader* loader) { | 31 virtual void CommitInstantLoader(InstantLoader* loader) OVERRIDE { |
| 31 } | 32 } |
| 32 | 33 |
| 33 virtual void InstantLoaderDoesntSupportInstant(InstantLoader* loader) { | 34 virtual void InstantLoaderDoesntSupportInstant( |
| 35 InstantLoader* loader) OVERRIDE { |
| 34 } | 36 } |
| 35 | 37 |
| 36 virtual void AddToBlacklist(InstantLoader* loader, const GURL& url) { | 38 virtual void AddToBlacklist(InstantLoader* loader, |
| 39 const GURL& url) OVERRIDE { |
| 37 } | 40 } |
| 38 | 41 |
| 39 private: | 42 private: |
| 40 DISALLOW_COPY_AND_ASSIGN(InstantLoaderDelegateImpl); | 43 DISALLOW_COPY_AND_ASSIGN(InstantLoaderDelegateImpl); |
| 41 }; | 44 }; |
| 42 | 45 |
| 43 } | 46 } |
| 44 | 47 |
| 45 class InstantLoaderManagerTest : public testing::Test { | 48 class InstantLoaderManagerTest : public testing::Test { |
| 46 public: | 49 public: |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 EXPECT_TRUE(manager.WillUpateChangeActiveLoader(1)); | 271 EXPECT_TRUE(manager.WillUpateChangeActiveLoader(1)); |
| 269 ASSERT_TRUE(manager.active_loader()); | 272 ASSERT_TRUE(manager.active_loader()); |
| 270 MarkReady(manager.active_loader()); | 273 MarkReady(manager.active_loader()); |
| 271 | 274 |
| 272 // Add a loader with id 1 and test again. | 275 // Add a loader with id 1 and test again. |
| 273 manager.UpdateLoader(1, &loader); | 276 manager.UpdateLoader(1, &loader); |
| 274 EXPECT_TRUE(manager.WillUpateChangeActiveLoader(0)); | 277 EXPECT_TRUE(manager.WillUpateChangeActiveLoader(0)); |
| 275 EXPECT_FALSE(manager.WillUpateChangeActiveLoader(1)); | 278 EXPECT_FALSE(manager.WillUpateChangeActiveLoader(1)); |
| 276 } | 279 } |
| 277 | 280 |
| OLD | NEW |