Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: chrome/browser/installable/installable_manager_unittest.cc

Issue 2178833002: Add new app banner metrics using InstallableStatusCode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@banner-integrate-checker-no-refptr
Patch Set: Fix histogram name Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/installable/installable_manager_browsertest.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698