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 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 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 void OnExtensionIconImageChanged(extensions::IconImage* image) override { | 73 void OnExtensionIconImageChanged(extensions::IconImage* image) override { |
74 // We keep the value of |image| to check if it's set, but the actual value | 74 // We keep the value of |image| to check if it's set, but the actual value |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 const std::string extension_origin = | 175 const std::string extension_origin = |
176 base::StringPrintf("chrome-extension://%s/index.html", kFooId); | 176 base::StringPrintf("chrome-extension://%s/index.html", kFooId); |
177 SetURL(extension_origin, true); | 177 SetURL(extension_origin, true); |
178 EXPECT_NE(null_image, icon_image()); | 178 EXPECT_NE(null_image, icon_image()); |
179 EXPECT_EQ(base::ASCIIToUTF16(kFooName), info()->label()); | 179 EXPECT_EQ(base::ASCIIToUTF16(kFooName), info()->label()); |
180 EXPECT_EQ(base::ASCIIToUTF16(extension_origin), info()->Tooltip()); | 180 EXPECT_EQ(base::ASCIIToUTF16(extension_origin), info()->Tooltip()); |
181 | 181 |
182 SetURL(kExampleUrl, true); | 182 SetURL(kExampleUrl, true); |
183 EXPECT_EQ(null_image, icon_image()); | 183 EXPECT_EQ(null_image, icon_image()); |
184 } | 184 } |
OLD | NEW |