| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/installable/installable_manager.h" | 5 #include "chrome/browser/installable/installable_manager.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "third_party/WebKit/public/platform/WebDisplayMode.h" | 9 #include "third_party/WebKit/public/platform/WebDisplayMode.h" |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 return manifest; | 32 return manifest; |
| 33 } | 33 } |
| 34 | 34 |
| 35 bool IsManifestValid(const content::Manifest& manifest) { | 35 bool IsManifestValid(const content::Manifest& manifest) { |
| 36 // Explicitly reset the error code before running the method. | 36 // Explicitly reset the error code before running the method. |
| 37 manager_->set_installable_error(NO_ERROR_DETECTED); | 37 manager_->set_installable_error(NO_ERROR_DETECTED); |
| 38 return manager_->IsManifestValidForWebApp(manifest); | 38 return manager_->IsManifestValidForWebApp(manifest); |
| 39 } | 39 } |
| 40 | 40 |
| 41 InstallableErrorCode GetErrorCode() { | 41 InstallableStatusCode GetErrorCode() { |
| 42 return manager_->installable_error(); | 42 return manager_->installable_error(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 std::unique_ptr<InstallableManager> manager_; | 46 std::unique_ptr<InstallableManager> manager_; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 TEST_F(InstallableManagerUnitTest, EmptyManifestIsInvalid) { | 49 TEST_F(InstallableManagerUnitTest, EmptyManifestIsInvalid) { |
| 50 content::Manifest manifest; | 50 content::Manifest manifest; |
| 51 EXPECT_FALSE(IsManifestValid(manifest)); | 51 EXPECT_FALSE(IsManifestValid(manifest)); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 EXPECT_EQ(MANIFEST_DISPLAY_NOT_SUPPORTED, GetErrorCode()); | 180 EXPECT_EQ(MANIFEST_DISPLAY_NOT_SUPPORTED, GetErrorCode()); |
| 181 | 181 |
| 182 manifest.display = blink::WebDisplayModeStandalone; | 182 manifest.display = blink::WebDisplayModeStandalone; |
| 183 EXPECT_TRUE(IsManifestValid(manifest)); | 183 EXPECT_TRUE(IsManifestValid(manifest)); |
| 184 EXPECT_EQ(NO_ERROR_DETECTED, GetErrorCode()); | 184 EXPECT_EQ(NO_ERROR_DETECTED, GetErrorCode()); |
| 185 | 185 |
| 186 manifest.display = blink::WebDisplayModeFullscreen; | 186 manifest.display = blink::WebDisplayModeFullscreen; |
| 187 EXPECT_TRUE(IsManifestValid(manifest)); | 187 EXPECT_TRUE(IsManifestValid(manifest)); |
| 188 EXPECT_EQ(NO_ERROR_DETECTED, GetErrorCode()); | 188 EXPECT_EQ(NO_ERROR_DETECTED, GetErrorCode()); |
| 189 } | 189 } |
| OLD | NEW |