| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/location_bar/origin_chip_info.h" | 5 #include "chrome/browser/ui/location_bar/origin_chip_info.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 const extensions::IconImage* icon_image() const { return icon_image_; } | 45 const extensions::IconImage* icon_image() const { return icon_image_; } |
| 46 | 46 |
| 47 void SetURL(const std::string& dest_url, bool expect_update) { | 47 void SetURL(const std::string& dest_url, bool expect_update) { |
| 48 url_ = GURL(dest_url); | 48 url_ = GURL(dest_url); |
| 49 NavigateAndCommit(url_); | 49 NavigateAndCommit(url_); |
| 50 toolbar_model_->set_url(url_); | 50 toolbar_model_->set_url(url_); |
| 51 | 51 |
| 52 EXPECT_EQ(expect_update, info_->Update(web_contents(), toolbar_model())); | 52 EXPECT_EQ(expect_update, info_->Update(web_contents(), toolbar_model())); |
| 53 } | 53 } |
| 54 | 54 |
| 55 virtual void SetUp() OVERRIDE { | 55 virtual void SetUp() override { |
| 56 ChromeRenderViewHostTestHarness::SetUp(); | 56 ChromeRenderViewHostTestHarness::SetUp(); |
| 57 #if defined(OS_CHROMEOS) | 57 #if defined(OS_CHROMEOS) |
| 58 test_user_manager_.reset(new chromeos::ScopedTestUserManager()); | 58 test_user_manager_.reset(new chromeos::ScopedTestUserManager()); |
| 59 #endif | 59 #endif |
| 60 toolbar_model_.reset(new TestToolbarModel()); | 60 toolbar_model_.reset(new TestToolbarModel()); |
| 61 info_.reset(new OriginChipInfo(this, profile())); | 61 info_.reset(new OriginChipInfo(this, profile())); |
| 62 } | 62 } |
| 63 | 63 |
| 64 virtual void TearDown() OVERRIDE { | 64 virtual void TearDown() override { |
| 65 info_.reset(); | 65 info_.reset(); |
| 66 toolbar_model_.reset(); | 66 toolbar_model_.reset(); |
| 67 #if defined(OS_CHROMEOS) | 67 #if defined(OS_CHROMEOS) |
| 68 test_user_manager_.reset(); | 68 test_user_manager_.reset(); |
| 69 #endif | 69 #endif |
| 70 ChromeRenderViewHostTestHarness::TearDown(); | 70 ChromeRenderViewHostTestHarness::TearDown(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 virtual void OnExtensionIconImageChanged( | 73 virtual void OnExtensionIconImageChanged( |
| 74 extensions::IconImage* image) OVERRIDE { | 74 extensions::IconImage* image) override { |
| 75 // We keep the value of |image| to check if it's set, but the actual value | 75 // We keep the value of |image| to check if it's set, but the actual value |
| 76 // is never used. | 76 // is never used. |
| 77 icon_image_ = image; | 77 icon_image_ = image; |
| 78 } | 78 } |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 scoped_ptr<OriginChipInfo> info_; | 81 scoped_ptr<OriginChipInfo> info_; |
| 82 scoped_ptr<TestToolbarModel> toolbar_model_; | 82 scoped_ptr<TestToolbarModel> toolbar_model_; |
| 83 GURL url_; | 83 GURL url_; |
| 84 extensions::IconImage* icon_image_; | 84 extensions::IconImage* icon_image_; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 const std::string extension_origin = | 176 const std::string extension_origin = |
| 177 base::StringPrintf("chrome-extension://%s/index.html", kFooId); | 177 base::StringPrintf("chrome-extension://%s/index.html", kFooId); |
| 178 SetURL(extension_origin, true); | 178 SetURL(extension_origin, true); |
| 179 EXPECT_NE(null_image, icon_image()); | 179 EXPECT_NE(null_image, icon_image()); |
| 180 EXPECT_EQ(base::ASCIIToUTF16(kFooName), info()->label()); | 180 EXPECT_EQ(base::ASCIIToUTF16(kFooName), info()->label()); |
| 181 EXPECT_EQ(base::ASCIIToUTF16(extension_origin), info()->Tooltip()); | 181 EXPECT_EQ(base::ASCIIToUTF16(extension_origin), info()->Tooltip()); |
| 182 | 182 |
| 183 SetURL(kExampleUrl, true); | 183 SetURL(kExampleUrl, true); |
| 184 EXPECT_EQ(null_image, icon_image()); | 184 EXPECT_EQ(null_image, icon_image()); |
| 185 } | 185 } |
| OLD | NEW |